Reasons to Create Additional Heaps

In addition to the process’ default heap, you can create additional heaps in your process’ address space. You would want to create additional heaps in your own applications for the following reasons:

  • Component protection

  • More efficient memory management

  • Local access

  • Avoiding thread synchronization overhead

  • Quick free

Let’s examine each reason in detail.

Component Protection

Imagine that your application needs to process two components: a linked list of NODE structures and a binary tree of BRANCH structures. You have two source code files: LinkList.cpp, which contains the functions that process the linked list of NODEs, and BinTree.cpp, which contains the functions that process the binary tree of BRANCHes.

If the NODE ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.