Program Programs that fail to check for and properly handle memory allocation failures will have undefined behavior and are likely to crash when heap space is exhausted. Heap exhaustion can arise as a result of the following possible reasonsresult from:
- A memory leak
- An infinite loop
- The program requires more memory than is present by default in the heap
- Incorrect implementation of common data structures (for example, hash tables , or vectors, etc.)
- The total amount of Overall system memory is exhausted, possibly due to some because of other processes
- The maximum size of a process' data segment (set by
setrlimit()
) has been exceeded
...