* Arc Riley wrote, On 18/06/09 00:20:
It would be extremely helpful in developing bindings for other object systems if the glib's memory management could be overridden, ie;I've given this a lot of thought. Here's some ideas: A memory management interface which implements these. A class implements the interface with it's own specific management. This would be better done by late binding, the microsoft way, where the object supports IInterface so it can be queried for a complete memory management interface. As this isn't likely to be magically compatible with what we have now; I have another solution; based on a tree of memory allocation pools. Any allocation of memory (or super allocation) is registered with the memory pool library. It is then possible to call find_allocation(void* ptr) and be returned the management interface for that pointer. It may be easier if a library will mmap memory it allocates, it become a matter of checking which range of mmap'd memory the pointer lies between. Thus it will be easy to get the memory management interface associated with a pointer. Sam |