[Gc] Determining if pointer GC allocated

Hans Aberg haberg-1 at telia.com
Fri Dec 30 13:55:41 PST 2011

On 30 Dec 2011, at 21:12, Ivan Maidanski wrote:

>>> I've implemented GC_is_heap_ptr (C, not C++) - see commit dcf6f52 (master branch).
>>> Does it work for you?
>> I made some simple timings. It is significantly faster than using GC_base(), and overhead is less than 70% relative a function f() that just returns an integer. It means that, unless one can optimize away the function call, there is little point in caching the value.
> If your test case were written in C then it would be possible to define GC_API=static and include extra/gc.c directly from your code thus resulting everything to be compiled as a single module with GC_is_heap_ptr inlined (at some level of -O).

It might be possible from C++ using:
extern "C" {
#define GC_API static
#include "extra/gc.c"
but I get the error:
In file included from ./extra/gc.c:38:
./extra/../backgraph.c:15:10: fatal error: 'private/dbg_mlc.h' file not found
#include "private/dbg_mlc.h"
1 error generated.


More information about the Gc mailing list