41#define alloc_ptr(i) alloc_table[i]
42#define ind(ptr) (*((void**) ptr))
51 cerr <<
"Fatal error: out of memory\n";
94 if (
MEM_DEBUG >= 3)
cout <<
"Big alloc of " << sz <<
" bytes\n";
113 if (
MEM_DEBUG >= 3)
cout <<
"Big free of " << sz <<
" bytes\n";
157 if (
MEM_DEBUG >= 3)
cout <<
"Big alloc of " << s <<
" bytes\n";
165 *((
size_t*)
ptr) = s;
167 *((
size_t*)
ptr) = s;
169 *((
size_t*)
ptr) = ~s;
186 size_t s1 = *((
size_t*)
ptr);
188 size_t s = *((
size_t*)
ptr);
190 printf (
"%s %p size mismatch at %p %lu:%lu :%lu:%lu\n",
msg,
mem,
ptr, s,
195 printf (
"%s buffer overflow %x\n",
msg, *((
int*) ((
char*)
ptr + s - 1)));
209 size_t s= *((
size_t*)
ptr);
220 if (
MEM_DEBUG >= 3)
cout <<
"Big free of " << s <<
" bytes\n";
279 cout <<
"\n---------------- memory statistics ----------------\n";
291 cout <<
"Small mallocs : "
314#if defined(X11TEXMACS) && (!defined(NO_FAST_ALLOC))
317operator new (
size_t s) {
334operator delete (
void*
ptr) {
336 size_t s= *((
size_t*)
ptr);
348operator new[] (
size_t s) {
365operator delete[] (
void*
ptr) {
367 size_t s= *((
size_t*)
ptr);
The list class represents a linked list.
void * fast_realloc(void *ptr, size_t old_size, size_t new_size)
bool break_stub(void *ptr)
void fast_delete(void *ptr)
void fast_free(void *ptr, size_t sz)
void * alloc_table[MAX_FAST]
void fast_free_mw(void *ptr, size_t s)
void * fast_alloc_mw(size_t s)
void * fast_new(size_t s)
void * fast_alloc(size_t sz)
void * safe_malloc(size_t sz)
int compute_free(void *ptr)
void * enlarge_malloc(size_t sz)
void * alloc_check(const char *msg, void *ptr, size_t *sp)