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
123
votes
5 answers

Why Large Object Heap and why do we care?

I have read about Generations and the Large Object Heap, but I still fail to understand what the significance (or benefit) is of having the Large Object Heap? What could have gone wrong (in terms of performance or memory) if the CLR would have just…
Manish Basantani
  • 16,931
  • 22
  • 71
  • 103
26
votes
3 answers

Garbage Collection not happening even when needed

I made a 64-bit WPF test app. With my app running and with Task Manager open, I watch my system memory usage. I see I'm using 2GB, and I have 6GB available. In my app, I click an Add button to add a new 1GB byte array to a list. I see my system…
Buzz
  • 512
  • 1
  • 4
  • 11
21
votes
7 answers

Allocating more than 1,000 MB of memory in 32-bit .NET process

I am wondering why I'm not able to allocate more that 1,000 MB of memory in my 32-bit .NET process. The following mini application throws an OutOfMemoryException after having allocated 1,000 MB. Why 1,000 MB, and not say 1.8 GB? Is there a…
Stefan Schultze
  • 9,240
  • 6
  • 35
  • 42
16
votes
3 answers

Heap fragmentation when using byte arrays

I have a C# 4.0 application (single producer/single consumer) which transfers huge amount of data in chunks. Although there's no new memory allocation I run out of memory after a while. I profiled memory using Redgate memory profiler and there are a…
Xaqron
  • 29,931
  • 42
  • 140
  • 205
16
votes
4 answers

Memorystream and Large Object Heap

I have to transfer large files between computers on via unreliable connections using WCF. Because I want to be able to resume the file and I don't want to be limited in my filesize by WCF, I am chunking the files into 1MB pieces. These "chunk" are…
flayn
  • 5,272
  • 4
  • 48
  • 69
16
votes
6 answers

Large Arrays, and LOH Fragmentation. What is the accepted convention?

I have an other active question HERE regarding some hopeless memory issues that possibly involve LOH Fragmentation among possibly other unknowns. What my question now is, what is the accepted way of doing things? If my app needs to be done in Visual…
Gorchestopher H
  • 1,141
  • 3
  • 17
  • 35
12
votes
3 answers

RegEx, StringBuilder and Large Object Heap Fragmentation

How can I run lots of RegExes (to find matches) in big strings without causing LOH fragmentation? It's .NET Framework 4.0 so I'm using StringBuilder so it's not in the LOH however as soon as I need to run a RegEx on it I have to call…
dr. evil
  • 26,944
  • 33
  • 131
  • 201
12
votes
1 answer

Avoiding OutOfMemoryException during large, fast and frequent memory allocations in C#

Our application continuously allocates arrays for large quantities of data (say tens to hundreds of megabytes) which live for a shortish amount of time before being discarded. Done naively this can cause large object heap fragmentation, eventually…
11
votes
4 answers

Large Object Heap and String Objects coming from a queue

I have a windows console app that is supposed to run without restarts for days and months. The app retrieves "work" from an MSMQ and process it. There are 30 threads that process a work chunk simultaneously. Each work chunk coming from the MSMQ is…
Yannis
  • 6,047
  • 5
  • 43
  • 62
10
votes
2 answers

Large Object Heap friendly IDictionary

We have an application that holds large numbers of objects in several Dictionarys, some of which grow continually during the lifetime of the app (trading application with lots of instruments and continually growing orders/trades). We are having…
SimonC
  • 6,590
  • 1
  • 23
  • 40
10
votes
4 answers

GC.Collect on only generation 2 & large object heap

In my application there is a specific time when a number of large objects are all released at once. At that time I would like to do a garbage collection on specifically the large object heap (LOH). I'm aware that you cannot do that, you must call…
DevinB
  • 8,231
  • 9
  • 44
  • 54
10
votes
1 answer

Cannot create JVM with -XX:+UseLargePages enabled

I have a Java service that currently runs with a 14GB heap. I am keen to try out the -XX:+UseLargePages option to see how this might affect the performance of the system. I have configured the OS as described by Oracle using appropriate shared…
teabot
  • 15,358
  • 11
  • 64
  • 79
9
votes
1 answer

C# Large object in medium size collection

I'm pretty new to the memory problem. Hope you don't think this is a stupid question to ask. I know that memory larger than 85,000 Bytes would be put into LOH in C# i.e. Byte[] hugeByteCollection = new Byte[85000]; I'm wondering if a collection…
cscmh99
  • 2,701
  • 2
  • 15
  • 18
9
votes
6 answers

Should I call GC.Collect immediately after using the large object heap to prevent fragmentation

My application does a good deal of binary serialization and compression of large objects. Uncompressed the serialized dataset is about 14 MB. Compressed it is arround 1.5 MB. I find that whenever I call the serialize method on my dataset my large…
Mark
  • 5,223
  • 11
  • 51
  • 81
9
votes
1 answer

Large Object Heap Fragmentation, Issues with arrays

I am writing an analysis application in C# that has to deal with a lot of memory. I use ANTS Memory Profiler 7.4 for optimizing my memory management. While doing so, I realized that all of my double[,] arrays I use (and i need them) are placed on…
1
2 3 4 5 6 7