Re: [Vala] array memory leak?



Hi Juerg,

According to valgrind 3.9.0, there are no leaks with this test code on
my system (up-to-date Linux on x86-64). I've tested with valac 0.20.1
and valac 0.22.1.

Confirmed, valgrind shows no memory leak. I'm puzzled.

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');
}

//test 1: memory used by Dummy1 still used after return from Dummy1
int main(string[] args)
{
  Dummy1(100);
  for(;;);
  return 0;
}

//test 2: memory used by Dummy1 FREED after return from Dummy1. WTF?
int main(string[] args)
{
  Dummy1(100);
  MainLoop loop = new MainLoop ();
  loop.run();
  return 0;
}

WTF? Is there a hidden garbage collector within the main loop or what?

Im TOTALLY puzzled now. Seems I have much to learn left, someone
illuminate me PLEASE ;-)

-- 
Bernhard


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