Monday, February 12, 2007

Large Object Heap Fragmentation

If an object is 85,000 bytes or larger, it is allocated on the large object heap. Unlike the rest of the managed heap, the Large Object Heap is not compacted due to the cost of moving the large objects.

To avoid Large Object Heap fragmentation, the basic strategy is to determine how to reduce the application's reliance on temporary large objects, which are causing the gaps in the large object heap. If the fragmentation is due to re-allocating buffers, maintain a fixed set of buffers that are reused. If the fragmentation is being caused by concatenation of large numbers of strings, examine whether the System.Text.StringBuilder class can reduce the number of temporary strings created.

Adopted from Debug Leaky Apps: Identify And Prevent Memory Leaks In Managed Code by James Kovacs.



At 10:04 AM, Anonymous Anonymous said...; You saved my day again.

At 4:36 AM, Anonymous Anonymous said...

You have got to see this. Obama playing on XBox. Funniest video ever.


Post a Comment

<< Home