Voici une question simple. Pouvez-vous m'aider à trouver la fuite de mémoire dans ce code Vala? Si elle aide je peux poster le code généré c trop ^^Gdk.Pixbuf fuite de mémoire dans Vala, ou autre chose?
using GLib;
using Gtk;
using Gee;
void test1()
{
Gee.ArrayList<Gdk.Pixbuf> list = new Gee.ArrayList<Gdk.Pixbuf>();
for(int a = 0; a < 10000; a++)
{
string path = "/usr/share/icons/gnome/48x48/stock/data/stock_lock.png";
list.add(new Gdk.Pixbuf.from_file(path));
}
list.clear();
// when the function returns it *should* free all alocated memory, or am I missing something?
}
int main (string[] args)
{
Gtk.init(ref args);
// the memory usage here is ~3mb
test1();
// here it is ~94mb
Gtk.main();
return 0;
}
Avez-vous essayé d'exécuter le programme sous valgrind? Voir http://valgrind.org/docs/manual/quick-start.html pour un exemple. –