C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

new/malloc & free store/heap

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Kavya
Guest





PostPosted: Mon Oct 30, 2006 9:29 am    Post subject: new/malloc & free store/heap Reply with quote



I always thought heap and free store is same thing but I recently
starting hearing from people that these are different terms. They say
new uses free store and malloc/calloc/realloc uses heap.
Can someone through some light on this issues with some standard
reference if possible.
Back to top
Old Wolf
Guest





PostPosted: Mon Oct 30, 2006 10:10 am    Post subject: Re: new/malloc & free store/heap Reply with quote



Kavya wrote:
Quote:
I always thought heap and free store is same thing but I recently
starting hearing from people that these are different terms. They say
new uses free store and malloc/calloc/realloc uses heap.
Can someone through some light on this issues with some standard
reference if possible.

Generally, the two terms are interchangeable, when referring to
the free store.

A "heap" is a data structure which is sorted so that each node
is (greater | less than) all of its children. The term has come to
be synonymous with free store because traditional memory
allocators stored the list of free memory blocks in a heap structure.

However, some people prefer to say "free store" because modern
memory allocators may not use a heap structure, so it is not
very accurate to call them a "heap".

On any particular system, you may or may not find that new and
malloc allocate memory out of the same memory pool (whatever
you might call that pool). They might do, or they might not. Which
is why you should be careful to match new with delete, and malloc
with free.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.