Re: Garbage Collection for Cocoa?
Re: Garbage Collection for Cocoa?
- Subject: Re: Garbage Collection for Cocoa?
- From: "Alastair J.Houghton" <email@hidden>
- Date: Sun, 2 Nov 2003 14:09:15 +0000
On Sunday, November 2, 2003, at 10:42 am, Keith Bauer wrote:
I've been idly wondering whether it would be possible to get garbage
collection in Objective C.
The Boehm-Demers-Weiser collector (used by GCJ, d2c, &c) seems quite
stable on Mac OS X these days, so hopefully it would just be a matter
of slotting GC_malloc into appropriate places in the ObjC runtime...
The Boehm collector is also the one used by GNUStep when you've got GC
enabled.
Does anyone know where I should start? Override +alloc for NSObject
maybe? Or even lower -- somehow replace NSAllocateObject? Or lower
still -- actually replace the system malloc?
I was already experimenting with this idea, and I have some code that I
think probably works... but I need to do a bit more testing first, and
I wanted to package it as a framework (at the moment it's just built
using a Makefile). My code is a bit more complicated than just
replacing NSAllocateObject, for a variety of reasons, the main one
being that I wanted to take advantage of the fact that Hans Boehm's GC
library can take advantage of any layout information you may have for
objects it's managing, and given that the ObjC runtime already provides
this information, it seemed a shame not to take advantage of it.
I'll try to tidy what I've got into a framework, then maybe put it up
on SourceForge.
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.