Re: Free Store of memory



"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:703C8DE6-9A5D-43E3-A007-D303B49B7D20@xxxxxxxxxxxxx
I am learning the storage area of Windows memory, but I am not sure
what is the usage for Free Store area, what is the differences
between Free Store area and heap area?

http://www.gotw.ca/gotw/009.htm

The article makes a somewhat artificial distinction between memory
allocated by new and deallocated by delete (which it calls "free store")
and memory allocated by malloc and deallocated by free ("heap"). The
term "free store" is used in the C++ standard to describe a concept that
pretty much everybody calls "heap". I suspect this is done to avoid
confusion with a data structure also called "heap" (which has nothing at
all to do with memory allocation) - see make_heap et al.

In most implementations, new uses malloc internally, and delete uses
free, so there's just a single area of memory from which both kinds of
allocations come from. The standard explicitly allows new and delete to
be implemented this way. The standard doesn't require it though, so in
principle a legal implementation can maintain two separate areas
(personally, I don't know of any such implementation).

My guess is, the article emphasizes the two "separate" memory areas to
drive home an important point that you can't mix allocation functions:
memory allocated with new must be deallocated with delete, allocated
with new[] deallocated with delete[], and allocated with malloc and
variants deallocated with free.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • Re: Problem with malloc / calloc. Size not LARGE enough!
    ... I have traced it down to a call to strdup(). ... allocator and heap than the freethat is done later in the function. ... > smaller block allocation technique is failing for some reason. ... > memory allocation, which will only involve modifying a few lines of code. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: where? heap or stack?
    ... I wasn't bringing up the use of "heap" ... Eckel aren't aware of the distinction. ... If you thought I was arguing that heap and free store are the same, ...
    (comp.lang.cpp)
  • Re: static, global variable memory allocation
    ... I suppose you meant to say heap instead of head. ... store" was the allegedly canonical term well before C99 was ratified). ... stack and free store are not mentioned anywhere in the PDF od ... specifically differentiates between them on the Guru of the Week ...
    (comp.lang.c)
  • Re: static, global variable memory allocation
    ... term is free store. ... store" was the allegedly canonical term well before C99 was ratified). ... pile and the heap isn't. ... stack seems to be mentioned ...
    (comp.lang.c)
  • Re: Heap? what does it mean?
    ... What does a heap mean?I mena when it says, the memory location ... That is was allocated on the free store. ... you just ask the runtime system for it. ...
    (alt.comp.lang.learn.c-cpp)