[Gc] Faster to not call GC_free?

jim marshall jim.marshall at wbemsolutions.com
Mon Jun 4 13:11:27 PDT 2007


HI,
 I used Lothar Scholz recommendation of of doing a memset on the memory 
unfortunately this results in "smashed objects" because I am clearing 
the entire object including the GC's data.  Here is what I wrote:

> size_t ptrSize = GC_size(vptr);
>             if (ptrSize <= GC_SMALL_SIZE)
>             {
>                 memset(vptr, 0, ptrSize);
>             } else {
>                 GC_FREE(vptr);
>                 vptr = NULL;
>             }
for example is there a set size of data that the GC will add to the ptr? 
so I can maybe do

memset(cptr, 0, ptrSize - GC_MEM_SIZE)

Thanks
-Jim

Hans Boehm wrote:
> On Sun, 3 Jun 2007, jim marshall wrote:
>
>   
>> This is a good question, what is a "small object"?  Any thoughts on
>> that, <5k, <10K, <20K?
>>     
> My rough guess would be on the order of 1K for the threads case, less
> without threads.  But that's only a guess.
>
> Hans
>   
>> --
>> Jim Marshall
>> Sr. Staff Engineer
>> WBEM Solutions, Inc.
>> 978-947-3607
>>
>> _______________________________________________
>> Gc mailing list
>> Gc at linux.hpl.hp.com
>> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>>
>>     
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>
>
>
>   

-- 
Jim Marshall
Sr. Staff Engineer
WBEM Solutions, Inc.
978-947-3607



More information about the Gc mailing list