Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!portal!cup.portal.com!DeadHead From: DeadHead@cup.portal.com (Bruce M Ong) Newsgroups: comp.unix.programmer Subject: malloc(3) - not can I return the memory to system pool? Message-ID: <38921@cup.portal.com> Date: 6 Feb 91 02:18:52 GMT Distribution: na Organization: The Portal System (TM) Lines: 19 I have a rather naive question and a bit of a problem: I have a daemon program that does a lot of mallocing and freeing during its lifetime(which is forever). I dont have any memory leak in the program, but it does do a lot of dynamic memory allocation. What I notice is that the daemon keeps on growing bigger and bigger. For example, it'd malloc a 1MB buffer, and then free it, and then malloc 2MB buffer, and free it, and then later on it'd malloc 1.5MB buffer, and free it, etc.... eventually it will grow to about 450K and maybe more (i found that number from the ps command). One question i have is: is there any thing I can do in the c program to return the malloced space back to the system instead of claiming that block of memory forever (even when you have freed it) until it exits? thanks for any hints, etc... and please email /bruce deadhead@cup.portal.com