What if I don't free() all my dynamically allocated memory?

Sun NCAA matthew at sunpix.UUCP
Fri Apr 7 23:03:46 AEST 1989


In article <2580 at ssc-vax.UUCP>, dmg at ssc-vax.UUCP (David Geary) writes:

             [complaints about _free() speed deleted.]

I doubt that you would have now problem, except if your program was used
so much that it ran out of allocatable memory.

I did have an Idea though, if you are constantly malloc()ing and free()ing
memory, why not create your own free routine {myfree()} what would add the 
now unused struct to a list of reusable structs, rather than free()ing it up
for the processors use.  Then when you need space for another struct, 
your personal malloc() {mymalloc()} would try getting a a myfree()'d struct, 
and failing that, malloc() a new struct.

-- 
Matthew Lee Stier                         |
Sun Microsystems ---  RTP, NC  27709-3447 |        "Wisconsin   Escapee"
uucp: { sun, mcnc!rti }!sunpix!matthew    |
phone: (919) 469-8300 fax: (919) 460-8355 |



More information about the Comp.lang.c mailing list