Mail Archives: cygwin/1998/07/10/08:21:59
I'd like to propose a change to the cygwin32.dll.
The goal is to allow user defined functions for malloc(), realloc(), and
free() can be used
instead of the standard allocator.
For example: a conservative garbage collector or debugging allocator
might be nice.
This can easily be done on most real UNIX systems by linking in a
different malloc() before
the system libraries. I found this will not work with Windows .dlls.
/* malloc.c */
/* Rename standard malloc(), realloc(), free() as follows */
void* _cygwin32_malloc(size_t size) ...
void* _cygwin32_realloc(void *ptr, size_t size) ...
void _cygwin32_free(void*ptr)...
/* or */
#define malloc _cygwin32_malloc
#define realloc _cygwin32_realloc
#define free _cygwin32_free
/* umalloc.c */
void *(*_cygwin32_malloc_func)(size_t ) = _cygwin32_malloc;
void *(*_cygwin32_realloc_func)(void*, size_t ) = _cygwin32_realloc;
void (*_cygwin32_free_func)(void*) = _cygwin32_free;
void *malloc(size_t s) { return (*_cygwin32_malloc_func)(s); }
void *realloc(void *p, size_t s) { return (*_cygwin32_realloc_func)(p,
s); }
void free(void *p) { return (*_cygwin32_free_func)(p, s); }
I'd implement this myself but I don't want to download all the source,
etc. It might be nice
if this could be implemented in the next release -- it's a small but
very useful change.
Thanks,
Please post AND reply directly,
Kurt A. Stephens
P.S. I'm so glad that sbrk() was implemented!
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -