discuss-gnustep
[Top][All Lists]
Advanced

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

Re: How does the GC support work?


From: Lloyd Dupont
Subject: Re: How does the GC support work?
Date: Thu, 8 Jun 2006 20:00:56 +1000

So if my understanding of what you said is correct only libobjc must be recompiled with Boehm GC to have a Garbage Collected GNUstep app, right? And retain/release will do nothing, wether or not I recompiled gnustep-base with GC?

I suppose I should use the library in dev-libs/libobjc?
And, perhaps, I just have to "make gc=yes" to have it compiled with GC, is that right?

Thanks for any tip!

Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
----- Original Message ----- From: "Richard Frith-Macdonald" <richard@tiptree.demon.co.uk>
To: "Lloyd Dupont" <lloyd@nova-mind.com>
Cc: "GNUstep Discussion" <discuss-gnustep@gnu.org>
Sent: Thursday, June 08, 2006 7:44 PM
Subject: Re: How does the GC support work?



On 8 Jun 2006, at 10:12, Lloyd Dupont wrote:

I'm thinking of building GNUstep with GC.
Does it works?

Probably not well ... I think it's been years since anyone used it ... of course someone may know different, but if anyone had been actively using it I would have hoped they would have provided patches with bugfixes and nobody has.

How does that work? I need to know a bit about the internal as I'm using GNUstep through a managed C++ wrapper and wonder how this will work...

That's an easier question ... it uses the boehm garbage collection library. You want to build gcc (well libobjc anyway) with GC support and link with that library.

Building the base library with GC enabled will turn off retain/ release/autorelease and also make the RETAIN/RELEASE/AUTORELEASE macros empty so that all the memory management stuff is removed from your code.

When an object of a class which implements -gcFinalize is allocated, that instance is registered with the garbage collection library to have the method called when the object gets freed by the garbage collector. That allows objects to handle the sort of cleanup they would normally do when dealloc is called (since dealloc is not called in a garbage collecting system). Most implementations of -dealloc just release objects/memory in ivars ... and the garbage collector will handle that anyway so classes with simple dealloc implementations like that do not need to have a finalizer.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]