public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* A patch for malloc.
       [not found] <37AB46E7.7228E760@wserv.com>
@ 1999-08-06 14:33 ` H.J. Lu
  1999-08-06 15:59   ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 1999-08-06 14:33 UTC (permalink / raw)
  To: Jordan Mendelson; +Cc: GNU C Library

> 
> 
> This one is a bit hard to get at, but this is what I see:
> 

Please try this patch. __libc_pagesize handling in glibc 2.1.2 and 2.2
is wrong since __pthread_initialize will call malloc () with wrong
__libc_pagesize. This patch fixes glibc 2.1.2.

Ulrich, please fix both glibc 2.1.2 and 2.2.

Thanks.


H.J.
---
Fri Aug  6 14:21:24 1999  H.J. Lu  <hjl@gnu.org>

        * malloc/malloc.c (ptmalloc_init): Make sure __libc_pagesize is
        initiailized before any calls to malloc.

--- ../../import/glibc-2.1/libc/malloc/malloc.c	Wed Jul 21 07:30:38 1999
+++ malloc/malloc.c	Fri Aug  6 14:25:42 1999
@@ -1649,6 +1649,9 @@ ptmalloc_init __MALLOC_P((void))
 
   if(__malloc_initialized >= 0) return;
   __malloc_initialized = 0;
+#ifdef _LIBC
+  __libc_pagesize = __getpagesize();
+#endif
 #ifndef NO_THREADS
 #if defined _LIBC || defined MALLOC_HOOKS
   /* With some threads implementations, creating thread-specific data
@@ -1663,7 +1666,6 @@ ptmalloc_init __MALLOC_P((void))
   /* Initialize the pthreads interface. */
   if (__pthread_initialize != NULL)
     __pthread_initialize();
-  __libc_pagesize = __getpagesize();
 #endif
   mutex_init(&main_arena.mutex);
   mutex_init(&list_lock);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A patch for malloc.
  1999-08-06 14:33 ` A patch for malloc H.J. Lu
@ 1999-08-06 15:59   ` Ulrich Drepper
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 1999-08-06 15:59 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Jordan Mendelson, GNU C Library

hjl@lucon.org (H.J. Lu) writes:

> Ulrich, please fix both glibc 2.1.2 and 2.2.

Done.  Thanks

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A patch for malloc
  1998-08-11  7:38 H.J. Lu
@ 1998-08-11 14:02 ` Ulrich Drepper
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 1998-08-11 14:02 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU C Library

hjl@lucon.org (H.J. Lu) writes:

> Here is a patch for malloc. It is quite confusing without 0x.

I've changed the code to use %p.  Thanks,

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* A patch for malloc
@ 1998-08-11  7:38 H.J. Lu
  1998-08-11 14:02 ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 1998-08-11  7:38 UTC (permalink / raw)
  To: GNU C Library

Here is a patch for malloc. It is quite confusing without 0x.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Tue Aug 11 07:37:50 1998  H.J. Lu  (hjl@gnu.org)

	* malloc/malloc.c (free_check): Add 0x to print a pointer.
	(realloc_check): Likewise.

Index: malloc/malloc.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc-2.0/malloc/malloc.c,v
retrieving revision 1.1.1.4
diff -p -u -r1.1.1.4 malloc.c
--- malloc.c	1998/05/20 21:51:16	1.1.1.4
+++ malloc.c	1998/08/11 14:36:20
@@ -4269,7 +4269,7 @@ free_check(mem) Void_t* mem;
     (void)mutex_unlock(&main_arena.mutex);
     switch(check_action) {
     case 1:
-      fprintf(stderr, "free(): invalid pointer %lx!\n", (long)(mem));
+      fprintf(stderr, "free(): invalid pointer 0x%lx!\n", (long)(mem));
       break;
     case 2:
       abort();
@@ -4307,7 +4307,7 @@ realloc_check(oldmem, bytes) Void_t* old
     (void)mutex_unlock(&main_arena.mutex);
     switch(check_action) {
     case 1:
-      fprintf(stderr, "realloc(): invalid pointer %lx!\n", (long)(oldmem));
+      fprintf(stderr, "realloc(): invalid pointer 0x%lx!\n", (long)(oldmem));
       break;
     case 2:
       abort();

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-08-06 15:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <37AB46E7.7228E760@wserv.com>
1999-08-06 14:33 ` A patch for malloc H.J. Lu
1999-08-06 15:59   ` Ulrich Drepper
1998-08-11  7:38 H.J. Lu
1998-08-11 14:02 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).