2 /* Copyright (c) 2000 Digital Mars */
3 /* All Rights Reserved */
5 /* NOTE: This file has been patched from the original DMD distribution to
6 work with the GDC compiler.
8 Modified by David Friedman, May 2005
18 #include "../root/mem.h"
23 /* This implementation of the storage allocator uses the standard C allocation package.
32 char *Mem::strdup(const char *s
)
46 void *Mem::malloc(size_t size
)
60 void *Mem::calloc(size_t size
, size_t n
)
67 p
= ::calloc(size
, n
);
74 void *Mem::realloc(void *p
, size_t size
)
90 p
= ::realloc(p
, size
);
97 void Mem::free(void *p
)
103 void *Mem::mallocdup(void *o
, size_t size
)
121 fprintf(stderr
, "Error: out of memory\n");
125 void Mem::fullcollect()
129 void Mem::mark(void *pointer
)
131 (void) pointer
; // necessary for VC /W4
134 /* =================================================== */
136 void * operator new(size_t m_size
)
138 void *p
= malloc(m_size
);
141 fprintf(stderr
, "Error: out of memory\n");
146 void operator delete(void *p
)