Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between the heap and the free store? [duplicate]

Tags:

People also ask

What is the difference between free store and heap?

Free Store is a pool of un-allocated heap memory given to a program that is used by the program for dynamic allocation during the execution of program. Every program is provided with a pool of un-allocated heap memory that it may utilize during the execution.

What is the free store also called the heap?

The “free store” is just another name for the heap. It is an area of memory that is used for dynamic allocation of memory while the program is running (i.e., at run time). Dynamic allocation of memory from the heap allows us to create, use, and dispose of objects as needed.

What is heap store?

The heap is a memory used by programming languages to store global variables. By default, all global variable are stored in heap memory space. It supports Dynamic memory allocation. The heap is not managed automatically for you and is not as tightly managed by the CPU. It is more like a free-floating region of memory.

What are all the function is used to allocate memory from free store heap memory?

In C, dynamic memory is allocated from the heap using some standard library functions. The two key dynamic memory functions are malloc() and free(). The malloc() function takes a single parameter, which is the size of the requested memory area in bytes.


Originally a pedantics war on @Als answer here, it also sparked a discussion in the C++ chatroom.

This article by Herb Sutter distinguishes between the two, but is also over a decade old, as it clearly was written before 2000 and also talks about the standard draft, which can only mean C++98 draft. Though, I still expect Herb, as part of the committee, to be knowledgeable about this stuff.

I know of this and this question/answer, but the second just cites Herb's article while the first cites another source that simply rejects the use of the term "heap", aka they are both not exactly satisfactory. Also, I can't find any free-store or freestore tag on SO (until this question, I created the former one now).

Now, what is really the difference, if any?