Need help monitoring malloc() and free()
Randy Tidd
rtidd at ccels3.mitre.org
Fri Jan 18 07:51:08 AEST 1991
In the application i'm writing, i'm running into some serious
performance problems I think are related to wasted memory. I'm trying
to track down bugs along the lines of:
int i;
char *s;
for(i=0; i<10; i++)
s = (char *) malloc(1024);
free(s);
What I was thinking is making a front end to malloc() and free(), so
all calls to malloc() would actually call my routine and my routine
would in turn call the malloc() that lives in libc.a. I tried to play
games with the loader and separate compilation but couldn't get it to
work. I *don't* want to write my own malloc() routines, besides that
would result in different performance problems and the addition of
more variables.
I am using SunOS 4.1 and both the native cc and gcc-1.38. I noticed a
couple semi-useful routines in SunOS, such as mallocmap() and
malloc_debug(), but I can't seem to tailor these to what I need.
Does anyone have any suggestions? Please reply through e-mail.
Thanks!
Randy Tidd
rtidd at mwunix.mitre.org
"Never mind what's been selling, it's what you're buying."
More information about the Comp.unix.programmer
mailing list