[Vala] array memory leak?



Consider the following (dummy) functions which shows memory leaks here
(valac 0.20.1 on ubuntu saucy 64Bit). It seems the problem exists with
Gee.ArrayList too. May someone confirm this?

//memory leak if len<120 (nfill ist NOT the problem)
//NO memory leak if len>=120
void Dummy1(int len)
{
        const int LOOPS=1000000;
        string[] dummy = new string[LOOPS];
        for(var xx=0; xx<LOOPS; xx++)
                dummy[xx]=string.nfill(len, 'x');
}

//memory leak if len<24 (nfill ist NOT the problem)
//NO memory leak if len >=24
void Dummy2(int len)
{
        const int LOOPS=1000000;
        string[] dummy={};
        for(var xx=0; xx<LOOPS; xx++)
                dummy+=string.nfill(len, 'x');
}

class CDummy : GLib.Object
{
        private int member;
        public CDummy(int param) { member=param; }
}
void Dummy3() //memory leak
{
        const int LOOPS=1000000;
        CDummy[] dummy = new CDummy[LOOPS];
        for(var xx=0; xx<LOOPS; xx++)
                dummy[xx] = new CDummy(xx);
}




-- 
Bernhard


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]