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

How can I know the ACTUAL maximum number of elements a .net array of a given type can be allocated?

I know that all arrays in .net are limited to 2 GB, under this premise, I try not to allocate more that n = ((2^31) - 1) / 8 doubles in an array. Nevertheless, that number of elements still doesn't seem to be valid. Anyone knows how can I determine…
Anzurio
  • 16,780
  • 3
  • 39
  • 49
2
votes
0 answers

Nhibernate incrementally saving binary data

Following up from Avoiding the LOH when reading a binary In Nhibernate would it be possible to save a Stream to database in chunks? With the following code, a FileStream is opened and its contents are read in 2kb chunks: using (var fs = new…
user1838662
  • 503
  • 7
  • 17
2
votes
1 answer

Is it normal for ASP.NET memory dump to contain strings of the full html page?

We have a situation where the ASP.NET worker process is using 100% of CPU intermittently. After analyzing the perfmon result and the memory dump, we saw an indication that the garbage collector is using the CPU time heavily. Using WinDbg, we saw…
chenz
  • 730
  • 7
  • 13
2
votes
1 answer

Returning big byte arrays from WCF - Memory issue

I need to return a big byte array from a WCF server. The problem is - in order to return such an array - I need to create one - and when creating such an array - it automatically goes to the Large Object Heap - meaning that when the service is…
Roy Reznik
  • 2,040
  • 4
  • 22
  • 28
2
votes
1 answer

How to remove a Byte[] on the Large Object Heap that is being held by ServiceHost

I have a WCF Service was uses the HTTP protocol. When a particularly large query hits the system, it creates a large Byte[] that leads up through buffers to HttpChannelListener and eventualy to the Service Host itself. This stays there even after…
gin drskvy
  • 305
  • 2
  • 11
2
votes
1 answer

Understanding Large Object Heap and stats output by DumpHeap

Say I have following class: Class A { B b; C c; D d; } First, I allocate: var b1 = new B(); var c1 = new C(); var d1 = new D(); each of b1, c1, d1 is less than 85K, so they get allocated on the small object heap. Then I do: var a1 = new A { b =…
morpheus
  • 18,676
  • 24
  • 96
  • 159
2
votes
3 answers

extremely large objects and managed heap in C#

What will happen when i`ll try to save in physical memory very large objects, which are larger than managed heap? For example, the size of a film is 4.5 GB, and the size of virtual memory (RAM) is only 2 GB. How will garbage collector work in this…
1
vote
4 answers

Java Memory Allocation of large object sets

I'm currently working on a game engine in java, however I'm having preformance issues when allocating large sets of objects on the heap, for example public class GLParticleSystem { private GLParticle[] particles = new GLParticle[2000]; private…
garyamorris
  • 2,587
  • 2
  • 17
  • 23
1
vote
2 answers

StringBuilder growing over 85k and moving to LOH?

Possible Duplicate: How does StringBuilder's capacity change? Let's say a StringBuilder is allocated and then it grows to over 85k, will it get moved over to the Large Object Heap?
nemo
  • 1,504
  • 3
  • 21
  • 41
1
vote
1 answer

What advantage is there to only collecting large-object-heap objects with Generation 2?

I understand that generational garbage collection improves performance, since Any object will have to be moved at most twice in non-Gen2 collections, and Gen2 collections are rare. If the system is performing a Gen0 collection and an object (Gen1 or…
supercat
  • 77,689
  • 9
  • 166
  • 211
1
vote
0 answers

If an object in the Large Object Heap references small objects should this prevent them from being garbage collected before a generation 2 GC?

My .NET Core 2.1 application, running on Windows x64, allocates large arrays of structs, each struct holding a class in a field. The arrays end up on the Large Object Heap, so they are not collected until a full (gen 2) GC. That was expected. What…
EM0
  • 5,369
  • 7
  • 51
  • 85
1
vote
1 answer

LOH internals wanted

I know, it is an implementation detail, and some people think it is forbidden to be interested into them. But I nevertheless want to find references for, and confirmation of, the following: The large object heap maintains a free-list of holes in a…
user492238
  • 4,094
  • 1
  • 20
  • 26
1
vote
1 answer

Can big strings cause large object heap fragmentation?

Can big strings (85kb+) cause large object heap fragmentation like large arrays?
dr. evil
  • 26,944
  • 33
  • 131
  • 201
1
vote
1 answer

Default strategy for large object heap compaction

What is, by default, the strategy used by the .NET framework to compact the large object heap? never compacted compacted after a while (not as aggressively as generational heap) What holds? If "after a while", are there a few details about "how…
Benoit Sanchez
  • 681
  • 6
  • 21
1
vote
1 answer

Fragmentation on .NET LOH due to pinned objects

I'm troubleshooting an application written in .net 4.5 Asp.net + Unity 3.0.1304.1 + Nhibernate 3.3.1.4 that reaches 3 to 5 GB of memory consumption, which is above the expected. After collecting some Memory Dumps it became clear there was…
IgorMrcl
  • 19
  • 3