GLib RFC: Improve checking provided with --enable-mem-check

James Henstridge james@daa.com.au
Thu, 7 Jun 2001 18:07:25 +0800 (WST)


On Thu, 7 Jun 2001, Ben Stanley wrote:

> Thanks for all the replies.
>
> I am now planning to maintain a separation between all the hash table
> data and the user block areas, to increase robustness in the face of
> rogue programs.
>
> I looked at the pluggable interface in glib 1.3.5. It seems that the
> g_malloc/g_free etc functions must be installed by the program at the
> beginning of main, before initialising glib etc. However, I wish to
> support installing the debugging memory manager into a previously
> compiled program. This is already possible by compiling glib 1.2.x with
> --enable-mem-check and installing it into a non-standard location (or
> with a non-standard name), and then using

One slightly hackish and not totally portable would be to put your
alternative memory allocators into a shared library which is dynamically
linked to glib, and put the glib memory allocation function initialisers
in a function called _init.

Then you should be able to just LD_PRELOAD the library.

James.

-- 
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/