Re: [Vala] Help with Memory Leak



On Fri, 2012-07-06 at 13:21 -0700, Evan Nemerson wrote:
Get rid of (owned).  That is used to transfer ownership of a reference,
but g_menu_item_set_label doesn't steal the reference you pass it, so
what ends up happening here is that GTK+ will copy the string you pass
it, and since you told Vala that you want to transfer ownership it will
not free the string when it goes out of scope, and you end up leaking
it.

While (owned) is definitely useless here, this should not cause a memory
leak, and in a quick test valac appears to handle this correctly.

Bruce, if you can provide a self-contained test case, I'll take a closer
look.

Regards,
Jürg




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