[Gc] Determining if pointer GC allocated

Henning Makholm makholm at octoshape.com
Tue Dec 20 16:35:29 PST 2011

On 2011-12-20 21:25, Hans Aberg wrote:

> Is there a function to check if a pointer has been allocated by the
>GC? That is, something like
>    bool is_on_heap(void* p);
> that returns true exactly when p has been allocated by the GC.
>And would such a function be time consuming?

Check whether GC_base(p) returns 0.

Henning Makholm
Octoshape ApS

More information about the Gc mailing list