delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/08/26/07:15:15

From: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: RE: Memory leaks in cygwin.dll
26 Aug 1998 07:15:15 -0700 :
Message-ID: <01BDD118.E07360C0.cygnus.cygwin32.developers@sos>
To: "'cygwin32-developers AT cygnus DOT com'" <cygwin32-developers AT cygnus DOT com>
Cc: "'Andy Piper'" <andyp AT parallax DOT co DOT uk>

Sergey Okhapkin wrote:
> 
> --- malloc.cc.orig      Fri May 29 14:18:09 1998
> +++ malloc.cc   Wed Aug 26 13:54:01 1998
> @@ -41,6 +41,7 @@ malloc (size_t size)

The changes for malloc.cc I sent before are wrong - only malloc calls from within cygwin.dll was traced. Here is the right patch:

--- malloc.cc.orig      Fri May 29 14:18:09 1998
+++ malloc.cc   Wed Aug 26 17:37:19 1998
@@ -80,6 +80,7 @@ void
 export_free (void *p)
 {
   in ("export_free");
+  malloc_printf ("(%p), called by %x\n", p, ((int *)&p)[-1]);
   if (use_internal_malloc)
     _free_r (_impure_ptr, p);
   else
@@ -98,6 +99,7 @@ export_malloc (int size)
     res = _malloc_r (_impure_ptr, size);
   else
     res = user_data->malloc (size);
+  malloc_printf ("(%d) = %x, called by %x\n", size, res, ((int *)&size)[-1]);
   out ("export_malloc");
   return res;
 }
@@ -112,6 +114,7 @@ export_realloc (void *p, int size)
     res = _realloc_r (_impure_ptr, p, size);
   else
     res = user_data->realloc (p, size);
+  malloc_printf ("(%x, %d) = %x, called by %x\n", p, size, res, ((int *)&p)[-1]);
   out ("export_realloc");
   return res;
 }
@@ -126,6 +129,7 @@ export_calloc (size_t nmemb, size_t size
     res = _calloc_r (_impure_ptr, nmemb, size);
   else
     res = user_data->calloc (nmemb, size);
+  malloc_printf ("(%d, %d) = %x, called by %x\n", nmemb, size, res, ((int *)&nmemb)[-1]);
   out ("export_calloc");
   return res;
 }



-- 
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019