[Gc] Faster to not call GC_free?

Lothar Scholz scholz at scriptolutions.com
Sat Jun 2 18:56:33 PDT 2007


Hello jim,

Sunday, June 3, 2007, 12:21:04 AM, you wrote:

jm> HI,
jm>  I'm using GC 6.8 in my application, we have designed the application to
jm> have its memory management be interchangeable (e.g. use GC, dmalloc or
jm> normal CRT malloc). As such we have designed our application to have our
jm> own internal allocation routines (mainly macros or inline functions). 
jm> After doing some reading the indication I get is that I maybe better off
jm> stubbing out our gc_free calls with no-ops or something like

jm> #define intFree(vptr) vptr=NULL

jm> Any thoughts on if this is worth while doing?

As others said already, GC_free is very usefull for larger objects
(how large?) but there is something else: false pointer recognition.
If you have very complex datastructures where everything is pointing
to each other it is very usefull to replace the GC_free with a
"memset(ptr,0,size)" and prevent this. This will safe time in the next
sweep phase, so maybe even the mutex lock of the GC_free might be
justified.

Because you have to maintain the free calls anyway for your normal malloc
i would be really interested in some benchmarks on your system.



-- 
Best regards,
 Lothar Scholz                mailto:scholz at scriptolutions.com



More information about the Gc mailing list