[Gc] Determining if pointer GC allocated

Hans Aberg haberg-1 at telia.com
Thu Dec 29 07:22:23 PST 2011

On 29 Dec 2011, at 15:49, Ivan Maidanski wrote:

> I've implemented GC_is_heap_ptr (C, not C++) - see commit dcf6f52 (master branch).
> Does it work for you?

Yes. I took it down and compiled it using the instructions on the link below, and tested on some C++ code that contains both statically and GC allocated objects.

It is good you made the argument 'const': in my situation, it avoids having to use casts.

Perhaps one might make faster versions, if one does not have to check it is a valid pointer, and just tell the general location (like on the function stack or on the heap). But that would probably be further down the road, if it proves useful.



More information about the Gc mailing list