[Mono-devel-list] Memory management for long running processes (desc-heap profiler)

Alex Chudnovsky alexc at majestic12.co.uk
Tue Mar 29 20:23:24 EST 2005


Ben Maurer wrote:

>Are you making allocations larger than say 10 mb. Doing that is a really bad idea today.
>  
>
Right, I finally got it, well at least the issue that affected me: GC 
was going mad because I was using BinaryReader's ReadString on a file 
that had corrupted data. Sicne ReadString first reads length of the 
string if that length was corrupted it meant that ReadString attempted 
to load a lot more data than it was supposed to! This is why GC was 
going mad allocating lots of memory because it was asked to read 40 megs 
in my case!

Solution was to use custom ReadString that will watch maximum length of 
data to detect situations like this. I hope this was the bug responsible 
for applications eating memory like there is no tomorrow for people who 
run my port as otherwise you might hear from me again on this topic!!!

cheers,

Alex





More information about the Mono-devel-list mailing list