Re: GObject: Freeing memory of instance members?
- From: Øystein Johansen <oystein gnubg org>
- To: gtk-list gnome org
- Subject: Re: GObject: Freeing memory of instance members?
- Date: Thu, 03 May 2007 22:40:17 +0200
David Nečas (Yeti) wrote:
> On Thu, May 03, 2007 at 09:51:05PM +0200, ?ystein Johansen wrote:
>> I have an instance struct that has a pointer to a some data that's
>> dynamically allocated in a method. How can I free this memory when the
>> object is finalzed? Is this done automatically in g_object_unref() (when
>> refcounter is zero) ?
>
> When the reference count reaches zero and the object is
> finalized, its finalize() method is called. And that's
> where you should free any possibly allocated memory.
Aha, but how/where to I set the pointer to the finalize() function?
> Remember to chain up parent class finalize() method in your
> finalize().
I will! :-)
-Øystein
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]