What is Large Object overhead

Use this forum to discuss subjects that don't belong in the other forums.
Post Reply
Posts: 1
Joined: Wed Jun 22, 2005 7:23 pm

What is Large Object overhead

Post by Anand » Wed Jun 22, 2005 7:33 pm

I am trying to understand if I have a problem with the size of my Large Object heap. I suspect that there is a memory leak in my app when I repeatedly open and close customers in the app. I take a snapshot of my app everytime i close a customer to compare my memory usage from one close to the next. Here are my perfmon values for my ASP app after opening and closing a few customers.

Bytes in all heaps - 6.9megs
Gen0 heap size - 163k
gen1 heap size - 12
gen2 heapsize - 3.5megs
large obj heap size - 3.2 megs

At a glance it seems like a lot of my memory usage is tied up in the large object heap and gen2 heap. But when I look through the profiler memory view I am getting the following reading

Gen 2 - ~3.5 megs (of which 3.4 is in data and about 48k in holes)
Large object - 3.3megs of which 54k in large heap and 3.2meg in overhead)

Now it seems like the gen2 reading in the profiler is pointing to objects over time not getting collected and moving from gen0/1 to gen2. That may be a problem but what I am not sure about is the Large object reading. If 3.2megs is in overhead does that indicate that there is or isn't a problem? I read somewhere that once used the memory committed to the large heap cannot be returned back so I am guessing the overhead will just sit there waiting to be allocated if ever. If this over head continues to grow you still have a problem with the app using up memory over time dont you? Is this what is apparent from this reading that at some point all 3.3 megs were used up in large object heap and even though 3.2 of it got collected the memory is just sitting there waiting to be reused?

Andreas Suurkuusk
Posts: 1031
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Sun Jun 26, 2005 9:07 pm


As far as I can see, the numbers presented do not indicate a problem and the perfmon values and profiler values seem to correlate.

When a heap snapshot is collected, several gen #2 collections are performed, thus all gen #0 and gen #1 gets promoted to gen #2. That's probably why the profiler only presents gen #2 information.

The large object heap works more like an unmanaged memory heap. Instances are not moved around on the heap, and it never gets compacted. Since it never gets compacted, it cannot easily be reduced (the holes may be scattered all over the heap). The large object heap overhead should not continue to grow; when a new large object is allocated, it will (hopefully) reuse previously released memory. I also believe that the size of the large object heap can be reduced, if the runtime finds a hole that it large enough. However, 3.2 megabytes is not a lot of memory, and you should not expect that memory to be released.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests