Re: [Vala] How to free delegate callbacks



On Mon, 2009-05-25 at 00:53 +0300, Adi Roiban wrote:
Hi,

I have this big problem with memory consumption.

Gtk.Entry entry = new Gtk.Entry();
for (float i=0; i < 1000000; i++) {
    entry.focus_in_event.connect( () => {});
}
Gtk.main();


When I run the above code it uses about 40MB. Without the callback its
only 700KB.

The only way I know to disconnect a signal handler is to explicitly
assign it a name first. eg, declare the handler as a member function,
then feed the function name to signal.disconnect.

Yu

Do you know what can I do to reduce the memory consumption?

Many thanks!




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