Questions tagged [large-object-heap]

The Large Object Heap (LOH) is a special type of managed heap for the automatic memory management in .NET Framework.

The Large Object Heap (LOH) is intended for storing large objects. The large objects is an object, which size is 85000 bytes or more. These features are most significant, when working with large objects and LOH:

  • Large objects are always considered part of generation 2.
  • Large objects are never compacted.
92 questions
4
votes
1 answer

Difference between 3rd gen objects and large object heap

What is the difference between large object heap and GC 3rd generation objects?
4
votes
0 answers

Can PerfView be used for finding source of fragmentation

I am finding PerfView to be very useful tool for determining root cause of various type of problems. However I am not sure if it can also be used to diagnose LOH fragmentation problem. I have collected a process memory snapshot using PerfView. In…
crazy novice
  • 1,757
  • 3
  • 14
  • 36
4
votes
2 answers

How to avoid allocation of large Byte[] when computing hash of large strings

I am on a mission to eliminate all (or as many as I can) allocations to the Large Object Heap as possible in my applications. One of the biggest offenders is our code that computes the MD5 hash of a large string. public static string MD5Hash(this…
Joe Enzminger
  • 11,110
  • 3
  • 50
  • 75
3
votes
1 answer

Visualizing Large Object Heap Fragmentation

Is there any tool out there to visualize large object heap? Currently I'm using ANTS Memory Profiler, it tells that LOH is fragmented but you can't actually see the fragmentation (I'm hoping to see a visual representation of LOH like Windows Defrag…
dr. evil
  • 26,944
  • 33
  • 131
  • 201
3
votes
3 answers

Pre-allocate some memory in Large Object Heap memory

i am working on a C# application and this application is facing memory crunch, because many objects are getting memory allocation in the Large object Heap. My C# application has to work on many large file (as an string object) and therefore the…
Kunal
  • 151
  • 1
  • 2
  • 6
3
votes
1 answer

LOH profiling says GC root objects (System.Object) are source of memory leak

I have a HttpHandler which is called frequently. It uses Entity Framework to accomplish its task. There's slow increasing in used memory by the w3p.exe of this web application (it has a separate application pool). I used ANTS memory profiler and…
Xaqron
  • 29,931
  • 42
  • 140
  • 205
3
votes
1 answer

Garbage collection of LOH, WeakReferences, large objects

In my application I need to load large files (can be about ~ 250 MB) into memory, I'm doing it in a lazy way - when user ask to see a file - I'm loading it. After that, every time user tries to access the file, I'm able to show it immediately ,…
3
votes
1 answer

Can continually writing to a stream without flushing force its contents onto the Large Object Heap?

In a multithreaded setting such as a webserver, in .NET, I generally try to avoid creating contiguous blocks of memory occupying more thank 85KB as that could end up on the large object heap, which could lead to memory problems. One of my fellow…
user420667
  • 6,552
  • 15
  • 51
  • 83
3
votes
1 answer

out-of-memory exception even though enough memory seems to be available

Occasionally our customers observe an out-of-memory exception in our application. Since we log their actions, we can roughly reproduce what they did, but if I do this and profile the application with dotMemory, I cannot reproduce the exception and…
MarkusParker
  • 1,264
  • 2
  • 17
  • 35
3
votes
0 answers

HttpWebResponses: How efficient is MemoryStream.CopyTo vs chunking?

I'm running into a problem with downloading large JSON objects from an API. Usually, this documents are small in size, but occasionally they are quite large (100k+). This puts the large object heap into play and there are some performance…
3
votes
1 answer

how to avoid strings causing fragmentation into LOH

My application read lot of data from text files that get into large object heap which eventually cause fragmentation issue. Are there any alternative design approaches that can help to not get these to LOH? I know about StringBuilder but it seem…
whoami
  • 1,689
  • 3
  • 22
  • 45
3
votes
2 answers

Large array support in ASP.NET

Recently with 4.5 .NET support, users can allocate more than 2 GB of memory for an object. In order to do that users can set the gcAllowVeryLargeObjects to true in the app.config file, and things would work fine. However I am having difficulty in…
dattebayo
  • 2,012
  • 4
  • 30
  • 40
2
votes
2 answers

Will my object be placed in the Large Object Heap?

When the CLR places an object on the Large Object Heap, is it an "all or nothing" deal? Are class/struct members "split up" and placed in different heaps? class OneBigObject { byte[] bigObject; public OneBigObject() { bigObject…
tbridge
  • 1,754
  • 1
  • 18
  • 35
2
votes
0 answers

Manual Large Object Heap compaction (server GC)

A while ago we got blessed with the ability to manually compact the Large Object Heap (LOH). I'v read through the GCSettings.LargeObjectHeapCompactionMode Property. What I cannot understand is if one should periodically set this property to…
Zverev Evgeniy
  • 3,643
  • 25
  • 42
2
votes
0 answers

OutOfMemoryException issue : Exception while having plenty of space and no LOH fragmentation

I'm having some weird OutOfMemory exception. We have an application, that basically draws some charts for data coming from some hardware devices. If I run the application with the MemoryProfiler, after some time, I got some OutOfMemoryException. We…
J4N
  • 19,480
  • 39
  • 187
  • 340