Heap
Almost any code, written in any programming language, uses Heap memory in some way. That's because the Heap has some unique advantages that cannot be achieved by using the Stack.
On the other hand, it also has some disadvantages; for example, it is slower to allocate a region of Heap memory in comparison to a similar region in Stack memory.
In this section, we are going to talk more about the Heap itself and the guidelines we should keep in mind when using Heap memory.
Heap memory is important because of its unique properties. Not all of them are advantageous and, in fact, some of them can be considered as risks that should be mitigated. A great tool always has good points and some bad points, and if you are going to use it properly, you are required to know both sides very well.
Here, we are going to list these features and see which ones are beneficial and which are risky:
- The Heap doesn't have any memory blocks that are allocated automatically...