Re: Memory leak because of fragmented Large Object Heap?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: David Browne (meat_at_hotmail.com)
Date: 03/02/05


Date: Wed, 2 Mar 2005 14:46:25 -0600


"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1c9027b6a3edf92c98be07@msnews.microsoft.com...
> Zeng <Zeng5000@hotmail.com> wrote:
>> hm, the article says "never compacted" for LOH
>
> Yes, but as Henning was saying, "never compacted" doesn't mean "never
> collected". There's a big difference.
>
> Large objects will be collected, and that space reused if there are
> suitable new large objects created. What won't happen is the space
> between two uncollected large objects being compacted.
>

Also when they say "never compacted", that doesn't mean that the LOH isn't
managed somehow. It means that it's not compacted evey time it's collected
and will tend to show some bloat over time. This is in contrast to the
generational heaps which are compacted after each collection. I've only
ever seen about 20% bloat with the LOH. Whether that's because it's
periodically compacted or just the behavior of the heap allocation logic is
an implementation detail.

So although the large object heap will develop slack space which you won't
be able to use, I wouldn't consider this a "Memory Leak" unless the amount
of slack space in the LOH failed to level off at some reasonable percentage
of the LOH size.

David



Relevant Pages

  • Re: outofmemoryException
    ... you're allocating huge gobs of memory and fragment the LOH, ... Also, the LOH heap does ... What do the other perf counters tell you? ... > I am accessing Blob from Oracle database using> OleDbDataReader,ExecuteReader method.I am getting an outofMemoryException> when blob keeps on accessing and total size of all the blobs exceeds 1 GB. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: difference between private static and public static.
    ... so they are NEVER on the GC heap. ... The GC and the JIT for instance are completely different, but you are right, it doesn't say it's on the GC heap, while actually it is, be it on the LOH and not on the Generational heap. ... Now, I've done some more research to find out where static fields, holding references to boxed value types, actually have their roots. ... What's important is 3), here the static field reference 's', pointing to the boxed instance of S, is on the LOH. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: outofmemoryException
    ... I have dumped my application's managed heap using WinDBG(scenario:with 10 ... numbers of 16MB LongRaw data). ... exception.Pretends memory leak happens in the native memory. ... > you're allocating huge gobs of memory and fragment the LOH, ...
    (microsoft.public.dotnet.framework.clr)
  • Re: Memory leak because of fragmented Large Object Heap?
    ... the article says "never compacted" for LOH ... > while you right in saying the LOH is never compacting doesn't mean memory ... > this heap does never get freed. ...
    (microsoft.public.dotnet.framework.performance)