1 // Copyright (C) 2000-2001 by Chromium Communications
4 /* NOTE: This file has been patched from the original DMD distribution to
5 work with the GDC compiler.
7 Modified by David Friedman, September 2004
13 #include <sys/types.h> // for size_t
15 typedef void (*FINALIZERPROC
)(void* pObj
, void* pClientData
);
17 struct GC
; // thread specific allocator
21 GC
*gc
; // pointer to our thread specific allocator
26 // Derive from Mem to get these storage allocators instead of global new/delete
27 void * operator new(size_t m_size
);
28 void * operator new(size_t m_size
, Mem
*mem
);
29 void * operator new(size_t m_size
, GC
*gc
);
30 void operator delete(void *p
);
32 void * operator new[](size_t m_size
);
33 void operator delete[](void *p
);
35 char *strdup(const char *s
);
36 void *malloc(size_t size
);
37 void *malloc_uncollectable(size_t size
);
38 void *calloc(size_t size
, size_t n
);
39 void *realloc(void *p
, size_t size
);
41 void free_uncollectable(void *p
);
42 void *mallocdup(void *o
, size_t size
);
44 void check(void *p
); // validate pointer
45 void fullcollect(); // do full garbage collection
46 void fullcollectNoStack(); // do full garbage collection, no scan stack
47 void mark(void *pointer
);
48 void addroots(char* pStart
, char* pEnd
);
49 void removeroots(char* pStart
);
50 void setFinalizer(void* pObj
, FINALIZERPROC pFn
, void* pClientData
);
51 void setStackBottom(void *bottom
);
52 GC
*getThreadGC(); // get apartment allocator for this thread
57 #endif /* ROOT_MEM_H */