Xref: utzoo comp.lang.c:35292 comp.unix.programmer:851 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!think.com!linus!linus!ccels3.mitre.org!rtidd From: rtidd@ccels3.mitre.org (Randy Tidd) Newsgroups: comp.lang.c,comp.unix.programmer Subject: Need help monitoring malloc() and free() Message-ID: <1991Jan17.205108.3250@linus.mitre.org> Date: 17 Jan 91 20:51:08 GMT Sender: news@linus.mitre.org (Linus's News) Reply-To: rtidd@mwunix.mitre.org (Randy Tidd) Organization: The Mitre Corporation Lines: 30 Nntp-Posting-Host: ccels3.mitre.org 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@mwunix.mitre.org "Never mind what's been selling, it's what you're buying."