Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

Free Store and Heap

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

Answer:
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
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap