Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: C++
Expertise: Beginner
Oct 10, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Free Store and Heap

Is there any difference between heap and free store in C++?

The free store is a region of memory from which a program allocates dynamic memory using new. In most cases, the free store is implemented as a heap. Therefore, each allocation request returns a memory address that is higher than the previous one (as opposed to a stack, for instance). The terms "free store" and "heap" are often used interchangeably in the literature although technically, the free store needn't be implemented as a heap. Note also that "free store" is only applicable to C++. In C, the region of dynamic memory available at runtime is called "the heap" and is allocated using malloc() or calloc(). Note that malloc() and new might access two different memory heaps. Therefore, you shouln't relase memory allocated using malloc() with delete or call free() to release memory allocated using new.

DevX Pro
Thanks for your registration, follow us on our social networks to keep up-to-date