P
P
PerseforeComplete2021-09-17 19:17:50
.NET
PerseforeComplete, 2021-09-17 19:17:50

Is transfer between SOH and LOH possible in .NET?

SOH (small object heap), LOH (large object heap). The documentation says that LOH stores objects whose size is greater than 85000 bytes. Two questions immediately arise from this - does the CLR move from SOH to LOH those objects that have bloated during their lifetime and vice versa, does it move from LOH to SOH when the size of the object decreases below the limit?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-09-17
@PerseforeComplete

No, this does not happen, because the size of objects simply cannot change during operation.
The object is either immediately large or not immediately large

D
d-stream, 2021-09-17
@d-stream

I think it will be most indicative of the classic example "why you can't add strings" which is given to illustrate the work with StringBuilder:
string x = "small";
x=x+"something big";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question