Search code examples
heap-memorywindbg

!heap –s displays “Lock contention”


enter image description here

I’m analyzing a dump for native memory leak, and then I observed the “Lock contention” in the !heap –s output. I can’t remember seeing this before. What does this mean?


Solution

  • This is lock contention for the heap manager. High lock contention is generally caused by a high number of concurrent allocation requests. If the lock contention is high it is recommended to create individual heaps to reduce the overall lock contention. The function HeapCreate can be used to create new heaps (http://msdn.microsoft.com/en-us/library/aa366599%28v=vs.85%29.aspx).