Re: What's the difference between the heap and the freestore?
From: Dave Moore (dtmoore_at_rijnh.nl)
Date: 05/10/04
- Next message: NKOBAYE027: "Re: this is the end()"
- Previous message: Birger M?ller-Pedersen: "ECOOP 2004 - Call for Participation"
- In reply to: Jorge Rivera: "What's the difference between the heap and the freestore?"
- Next in thread: Jorge Rivera: "Re: What's the difference between the heap and the freestore?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 10 May 2004 06:04:33 -0700
Jorge Rivera <jorgeri@rochester.rr.com> wrote in message news:<lhsnc.17982$hY.13605@twister.nyroc.rr.com>...
> In general, when discussing dynamically allocated memory, I hear people
> referring to the heap. As of a couple of days ago, I though the heap
> was shared by new and malloc.
>
> I know that new must provide more information about the type of memory
> allocated than malloc, etc. However, can somebody explain in more
> details the differences between the heap and the freestore?
>
> I am interested in:
>
> 1. Do the heap and the freestore redside in different memory segments?
> 2. What information is stored in the freestore?
> 3. Why are the terms used interchangeably in most groups?
As I understand it, there is no conceptual difference between the
so-called 'heap' and 'free-store'. They are both used to refer to the
pool of memory from which a C++ program allocates storage for dynamic
objects. OTOH, according to Herb Sutter's GotW (I think #9), there is
a conventional difference between them in the C/C++ community, in that
'free-store' and 'heap' are generally used to refer to the pools of
memory from which operator new and malloc allocate objects,
respectively. One important thing to note is that these pools are not
required to be identical ... AFAIK they can in practice be distinct,
identical or overlapping. That is why you sometimes see questions
about whether memory allocated for objects using new can be
de-allocated using free (it is not safe practice to do so).
Now, I will say that is was old GotW, which pre-dates the Standard,
but I have since seen the conventions used elsewhere.
HTH, Dave Moore
- Next message: NKOBAYE027: "Re: this is the end()"
- Previous message: Birger M?ller-Pedersen: "ECOOP 2004 - Call for Participation"
- In reply to: Jorge Rivera: "What's the difference between the heap and the freestore?"
- Next in thread: Jorge Rivera: "Re: What's the difference between the heap and the freestore?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|