[uClibc]Re: malloc, munmap, etc...
Miles Bader
miles at gnu.org
Thu Nov 7 14:08:17 UTC 2002
On Thu, Nov 07, 2002 at 10:53:20AM +0100, Uwe Beutin wrote:
> I've applied the patches to the malloc directory and re-compiled it all
> but the boa-0.94-13 munmap problem is still there, I believe, worse than
> it was before since I am not making any page requests at all:
>
> munmap of non-mmaped memory by process 57 (boa): 10dd6d80
>
> Phew, it's probably a boa-thing with its implementatin of free()?!
>
> But apart from that, it seems that my heap is cleaner now.. at least
> I've not seen the free mem go down whilst my apps are running :)
I'm a bit confused; so you mean:
(1) The major memory leak seems to be fixed
(2) BUT you're still getting wierd messages from boa
(what do you mean by `not making any page requests at all'?)
Also, what does `it's probably a boa-thing with its implementatin of free'
mean? Does boa implement it's own version of the `free' function (what about
malloc)?
If it's still possibly a bug with uClibc malloc, does it happen reliably
enough that you could turn on malloc debugging messages to get some verbose
debug output? That might help track down a malloc bug. If you can do this,
use something like the following patch to compile in malloc debugging into
uClibc [I'm not sure if this patch still applies cleanly, but you get the
idea]:
diff -u libc/stdlib/malloc/Makefile /tmp/m
--- libc/stdlib/malloc/Makefile 2002-08-19 17:48:22 +0900
+++ /tmp/m 2002-09-13 16:46:39 +0900
@@ -26,10 +26,12 @@
# calloc.c can be found at uClibc/libc/stdlib/calloc.c
CSRC = malloc.c free.c realloc.c memalign.c \
- heap_alloc.c heap_alloc_at.c heap_free.c
+ heap_alloc.c heap_alloc_at.c heap_free.c heap_debug.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(COBJS)
+CFLAGS += -DMALLOC_DEBUGGING -DHEAP_DEBUGGING
+
all: $(OBJS) $(LIBC)
$(LIBC): ar-target
Once you do that, there will be two new global variables, `__heap_debug' and
`__malloc_debug', which if set to non-0 values, will cause all calls to
malloc/free/etc. to record of their activity on stderr. So you could add
something like this to boa's main function:
__malloc_debug = 1;
__heap_debug = 1;
[actually, for this case, __malloc_debug may be good enough]
Thanks,
-Miles
--
P.S. All information contained in the above letter is false,
for reasons of military security.
More information about the uClibc
mailing list