Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What kind of objects are stored in large object heap (LOH)

Im aware that large arrays and strings if they exceeds 85,000 bytes will be stored in LOH. Is there any other data types can be stored in LOH?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

"Anything big enough"

For example, you could use [InlineArray] in .NET 8 to create a struct that is absurdly big (I’m not saying that you should, it sounds like a terrible idea), and then you could put an absurd number of fields of that struct – or a "fixed-size buffer" of a large number of that struct as a single field – onto a class, and boom: LOH.

But… maybe don’t do that. In real world scenarios, this is mostly just arrays (in particular large byte arrays and suitably big arrays of a non-trivial value-type), and very large strings.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading