Re: [Vala] array memory leak?



Are you sure it's not because optimizations?

Try to put Dummy1 method in external compile unit(i.e. different .vala and .c file) and you should
get better results.

Tal

Date: Thu, 6 Mar 2014 11:00:05 +0100
From: ulink gmx at
To: vala-list gnome org
Subject: 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
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
                                          


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