Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Date: Fri, 30 Jun 2000 22:04:01 -0400 (EDT) From: "Ashif S. Harji" To: cygwin AT sourceware DOT cygnus DOT com Subject: user defined malloc Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 file findfp.c: struct _glue * __sfmoreglue (d, n) struct _reent *d; register int n; { struct _glue *g; FILE *p; g = (struct _glue *) _malloc_r (d, sizeof (*g) + n * sizeof (FILE)); if (g == NULL) return NULL; p = (FILE *) (g + 1); g->_next = NULL; g->_niobs = n; g->_iobs = p; memset (p, 0, n * sizeof (FILE)); return g; } 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++ program: int main(){} 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. thanks, ashif harji. -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com