[Objectivelib-discussion] Memory allocator removal?
Brought to you by:
will_mason
From: Will M. <wil...@us...> - 2005-08-01 21:27:49
|
I'm in the process of eliminating dependencies on Cocoa/GNUstep for ObjectiveLib. The memory allocator code barely works under Cocoa/GNUstep, but it completely fails in an Object-based system. The reason is that instead of using retain/release to hang onto and un-hang onto objects, you have to copy the object and later free it. There's no way to rely on a generic copy method for any given class that will make use of a desired allocator, as the copy-related methods in Object have no knowledge of ObjectiveLib memory allocators. This means that although an OLVector, for example, can allocate its memory cache using a given allocator, it can't copy the objects that it manages using a given allocator. This results in half-baked memory management. I'm considering eliminating memory allocators as they currently exist in ObjectiveLib in favor of letting people fall back to overriding alloc and free/dealloc in order to get specialized memory management for a given class. This will work equally well with all ObjectiveLib classes and all other classes, too. I was hoping to get some feedback on this idea before I gut the system. Thanks for any advice, Will |