[Mono-dev] [PATCH] Optimize Encoding.GetByteCount

Atsushi Eno atsushi at ximian.com
Wed Oct 25 18:02:02 EDT 2006


Hi,

Well, the point of the Ben's question is, compacting GC is likely to
store array in nursery area (likely, since it could be regarded too
big to store in nursery area), so nursery allocation and releasing
might become faster than fixing string pointer which might slowdown GC.

(That's why BenM asked Paolo, as only he would know the best answer ;-)

Atsushi Eno

Alan McGovern wrote:
>> To my understanding, fixed pointers do not participate GC target. And
>> - locally-allocated array anyways lives until its conversion finishes
>>    (and probably immediately disposed depending on the JIT optimization)
>> - Usually this conversion do not take long time
>> So I guess fixed pointer would work better than possibly being moved
>> from nursery area.
> 
> 
> It's better to not allocate a new array if it can be avoided. From my own
> code i found that in one of my intensively used methods i allocated a
> 100byte array each time the method was called. By moving that variable
> outside the method and just reinitialising it each time i used it (with
> appropriate locking) memory usage reduced by a large %. Don't rely on 
> the GC
> to tidy up your mess if you can avoid creating it in the first place :p
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list