[Mono-list] Too many heap sections: Increase MAXHINCR orMAX_HEAP_SECTS

Alan McGovern alan.mcgovern at gmail.com
Thu May 10 11:44:38 EDT 2007


>
> >Also, as a test, could you initialise the memory stream to roughly the
> size required to store the entire list<T> and see if it works then.


> That works fine if I do it that way.  But my problem is that I can't
> really know in advance how much memory the serialization will use, so it's
> not really a viable solution.  I'm thinking of trying to split up my list
> into smaller chunks to see it this could fix the problem by avoiding the
> large object heap, if there is such a heap in mono.
>

Sounds like your problem is due to heap fragmentation. The only solution is
to use a best-guess for the approximate size of the memory stream and
initialise the memorystream to that to start off with. For example if the
average size of your class is 68 bytes, then initialise the memorystream to
array.Length * 68. Or some such thing.

Still, a testcase may prove useful.

Alan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070510/3caaaf95/attachment.html 


More information about the Mono-list mailing list