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

Alan McGovern alan.mcgovern at gmail.com
Wed Oct 25 17:53:51 EDT 2006

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061025/be451a55/attachment.html 

More information about the Mono-devel-list mailing list