user defined malloc
Ashif S. Harji
Fri Jun 30 19:04:00 GMT 2000
It mentions in the faq that it is possible to override the default malloc
routine. The problem that I am having is that there is at least one
occasion when my malloc routine is not called for memory allocation.
Instead the function _malloc_r is called directly. This by passes my
malloc which results in already allocated memory being reallocated.
This direct call to _malloc_r occurs in the __sfmoreglue function in the
struct _glue *
__sfmoreglue (d, n)
struct _reent *d;
register int n;
struct _glue *g;
g = (struct _glue *) _malloc_r (d, sizeof (*g) + n * sizeof (FILE));
if (g == NULL)
p = (FILE *) (g + 1);
g->_next = NULL;
g->_niobs = n;
g->_iobs = p;
memset (p, 0, n * sizeof (FILE));
While I am not sure exactly what this function does, it appears to be
related to opening the /etc/passwd file and occurs even with an empty C++
My question is do I have to also override the _malloc_r routine, and if
so, could someone provide some information or a link on what is required?
It appears to be a reentrant version of malloc.
Want to unsubscribe from this list?
Send a message to firstname.lastname@example.org
More information about the Cygwin