Why might the Large Object Heap grow rather than throw an exception?
        Posted  
        
            by Unsliced
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Unsliced
        
        
        
        Published on 2010-05-28T14:36:47Z
        Indexed on 
            2010/06/03
            13:54 UTC
        
        
        Read the original article
        Hit count: 376
        
In a previous question I asked possible programatic ways of maximising the largest block allocatable on the LOH. I'm still seeing the problems, but now I'm trying to get my head around why the LOH seems to grow and shrink in size, yet I'm still seeing OutOfMemoryExceptions that tally with what others have reported as being due to LOH fragmentation.
Why might one call to, for example, StringBuilder.EnsureCapacity throw an OutOfMemoryException for me, but another call from somewhere else result in the LOH expanding in size (according to the performance counters, it is growing and shrinking)?
© Stack Overflow or respective owner