Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!rpi!batcomputer!cornell!uw-beaver!fluke!ssc-vax!dmg From: dmg@ssc-vax.UUCP (David Geary) Newsgroups: comp.lang.c Subject: What if I don't free() all my dynamically allocated memory? Keywords: On a Unix system, that is. Message-ID: <2580@ssc-vax.UUCP> Date: 6 Apr 89 00:40:43 GMT Organization: Boeing Aerospace Corp., Seattle WA Lines: 30 I'm writing some code where I use some home-grown functions to create, manipulate and destroy a tree of "generic" structures. (Each object in the tree is dynamically allocated using malloc()) The last thing I do in the program is to free every object in the tree. After running prof on the executable, I found that almost half my time was spent in _free! If I don't bother to free all of the memory I've dynamically allocated in the tree structure, my program runs considerably faster. Anyway, I'm wondering if it's ok for me to just leave the freeing out altogether. Unix will free all of my resources for me anyway right? Is there any problem with doing this? Of course, I realize this would cause serious problems if ever ported to a lowly PC, but I don't care ;-) Thanks for the help, David -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ David Geary, Boeing Aerospace, Seattle ~ ~ "I wish I lived where it *only* rains 364 days a year" ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~