PREV UP NEXT StackThreads/MP: version 0.77 User's Guide

4.1.1: GC_MALLOC and GC_FREE

The basic API is almost identical to malloc/free:

        #include <sgc.h>
@        void * GC_MALLOC(sz);
@                unsigned int sz;
@        void GC_FREE(ptr)
@                void * ptr;

Header file sgc.h comes with SGC, so you have to give an appropriate include search path to stgcc/stg++ (with -I$SGC_DIR, where $SGC_DIR is the directory when SGC is in).

GC_MALLOC(sz) allocates sz bytes of memory. GC_FREE(ptr), where ptr is a value previously returned by a call to GC_MALLOC, returns the allocated memory to the allocator. Functions and variables control behavior of SGC: