[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Will Swarm-2.0.1 compile with dmalloc?
From: |
Paul Johnson |
Subject: |
Will Swarm-2.0.1 compile with dmalloc? |
Date: |
Mon, 18 Oct 1999 18:40:36 -0500 |
I am trying to find a memory leak. I got started on dmalloc 11 months
ago, but only use it once every few months. There's something about
compiling Swarm-2.0.1 against dmalloc I can't get right.
I compiled the new dmalloc (version 4.3beta3) and am able to get my app
to compile with it.
(
The following change to /usr/include/swarm/misc.h was necessary:
--at the end of the includes add
#include <dmalloc.h>
and later around line 35 insert the #ifndef __DMALLOC_H__ /#endif 3
times
#ifndef __DMALLOC_H__
void *xmalloc (size_t size);
void *xmalloc_atomic (size_t size);
void *xcalloc (size_t nmemb, size_t size);
void *xrealloc (void *buf, size_t size);
void xfree (void *buf);
#endif
#define XFREE(buf) xfree((void *)(buf))
char *dropdir (char *path);
#ifndef __DMALLOC_H__
char *xstrdup (const char *string);
#endif
#ifndef __DMALLOC_H__
#ifndef HAVE_STRNDUP
char *strndup (const char *s, size_t n);
#endif
#endif
)
The issue now getting Swarm itself recompiled. This is necessary
because:
My code no longer uses xmalloc, that has been replaced with the Zone
Protocol's allocBlock:. If I use xmalloc, the dmalloc output points at
my files where the memory is allocated, but when I use allocBlock it
just gives those nondescriptive locations like ra0342342343.
I've been taking pot shots at compiling Swarm-2.0.1 with dmalloc support
all afternoon, I think now I may have it right. I included <dmalloc.h>
in defobj/Zone.m and then added the -ldmalloc to the Makefile in that
directory here:
override CFLAGS += "-Wno-unknown-pragmas -ldmalloc"
override OBJCFLAGS += "-Wno-unknown-pragmas -ldmalloc"
I also added -ldmalloc under EXTRALDFLAGS in the Makefilein the src
directory. Swarm seemed to compile OK.
When I try to make applications against that swarm, I use the command
make EXTRALIBS=-ldmalloc
I did not have to fiddle the misc.h file in the
/usr/local/swarm-2.0.1test/etc.
I get some informative stuff in the dmalloc logfile. They do point at
Zone.m, for example:
940289690: 188550: not freed: '0x83bdfe8|s1' (12 bytes) from 'Zone.m:33'
940289690: 188550: not freed: '0x83be008|s3' (28 bytes) from 'Zone.m:33'
What puzzles me is what I do next, i.e., how do I find out which of my
usages of allocBlock: is causing this particular leak?
------------------------
New topic: Compiling Checker????????
_____________________________
Since I hear from Marcus that Checker is an alternative memory checking
program, I've downloaded Checker 0.9.9.1 from GNU. Like the linux
kernel itself, I find I cannot compile this with gcc-2.95.1 (I think)
because of the problem described here: .
http://www.fsf.org/software/gcc/faq.html#asmclobber
The error when I try to make Checker is
gcc -O2 -Wall -DHAVE_CONFIG_H -c ../utils/genmess.c
gcc -o genmess genmess.o
rm -f -f errlist.h errlist.mes message.c message.h message.o
rm -f -f maccess.mes parse-args.mes
./genmess message.new.h message.new.c ../config/English/message.m
../move-if-change message.new.h message.h
make: [message.h] Error 1 (ignored)
../move-if-change message.new.c message.c
make: [message.h] Error 1 (ignored)
gcc -c -DGCCCHECKER -I. -I../l-malloc -I.. -I../lib
-I../config/obj-formats -I../config/i386/Linux -O2 -g -Wall
-Wstrict-prototypes -fno-strict-aliasing ../config/i386/Linux/linux.c
-o linux.o
gcc -c -DGCCCHECKER -I. -I../l-malloc -I.. -I../lib
-I../config/obj-formats -I../config/i386/Linux -O2 -g -Wall
-Wstrict-prototypes -fno-strict-aliasing ../config/i386/Linux/munmap.c
-o munmap.o
../config/i386/Linux/munmap.c: In function `chkr_munmap':
../config/i386/Linux/munmap.c:31: Invalid `asm' statement:
../config/i386/Linux/munmap.c:31: fixed or forbidden register 3 (bx) was
spilled for class BREG.
make: *** [munmap.o] Error 1
I guess an alternative explanation is that gcc-2.95.1 is really egcs as
far as the Checker docs are concerned, and I should apply the
patch/egcs.diffs from the Checker distribution.
--
Paul E. Johnson email: address@hidden
Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66045 FAX: (785) 864-5700
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- Will Swarm-2.0.1 compile with dmalloc?,
Paul Johnson <=