Click here to Skip to main content
15,885,278 members
Articles / Web Development / IIS

To Heap or not to Heap; That’s the Large Object Question?

,
Rate me:
Please Sign up or sign in to vote.
4.99/5 (85 votes)
11 Jul 2017MIT81 min read 95.1K   1.4K   109  
In this article we explored a theory; would it be better to not utilize a heap construct when dealing with very large objects in .NET, in order to avoid Large Object Heap (LOH) fragmentation?
This article is an investigation of Large Object Heap fragmentation. We outline a simple coding technique that goes directly to the OS with VirtualAlloc for large objects, avoiding the LOH altogether. We touch on the fact if a developer configures the machine to use Server Garbage Collection in Concurrent mode to reduce freezing of an application caused by garbage collection. We also touched on the fact if a developer were to manually compact the LOH from code; the compaction only occurs on the next blocking garbage collection. As a base starting point, we include a Sample Project implementing code for dealing with several common scenarios that can sometimes lead to excessive fragmentation of the LOH.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
United States United States
Doug Duerner is a senior software engineer with more than 15 years designing and implementing large-scale systems with Microsoft technologies. He has worked for several Fortune 500 banking institutions and for a commercial software company that designed and built the large-scale distributed network management system used by the Department of Defense’s Defense Information Systems Agency (DISA) for its “Global Information Grid” and the Department of State (DoS). He is a geek at heart, focusing on all aspects, but enjoys the most complex and challenging technical hurdles, especially those that everyone says “can’t be done.”

Written By
United States United States
Yeon-Chang Wang is a senior software engineer with more than 15 years designing and implementing large-scale systems with Microsoft technologies. He, too, has worked for a Fortune 500 banking institution and for a commercial software company that designed and built the large-scale distributed network management system used by the Department of Defense’s Defense Information Systems Agency (DISA) for its “Global Information Grid” and the Department of State (DoS). He also designed and implemented a large-scale Driver Certification System for one of the world’s largest chip manufacturers. Wang has a master’s degree in Computer Science. He eats complex problems for dinner.

Comments and Discussions