malloc(3) - not can I return the memory to system pool?
Bruce M Ong
DeadHead at cup.portal.com
Wed Feb 6 13:18:52 AEST 1991
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 at cup.portal.com
More information about the Comp.unix.programmer
mailing list