Re: stack and a heap



Yes, I know, sometimes when you know something implicitly, you forget to
state it, thanks for correcting my text.

--
Terry Burns
http://TrainingOn.net
"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.1d0bc5a44af5918d98c262@xxxxxxxxxxxxxxxxxxxxxxx
> Terry Burns <here@xxxxxxx> wrote:
>> They are both memory which is used to store objects. The stack by default
>> only stores Value types like Struct and Integers, whereas the Heap is
>> used
>> to allocate memory for reference types.
>
> That's an oversimplification, unfortunately. The stack is also used to
> store references (rather than the objects themselves), and all types
> can end up on the heap as part of other objects.
>
> See http://www.pobox.com/~skeet/csharp/memory.html
>
> Note that this doesn't explain the difference between the heap and the
> stack, just what goes where.
>
> --
> Jon Skeet - <skeet@xxxxxxxxx>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too


.



Relevant Pages

  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (comp.lang.cpp)
  • Re: Error Raising and Memory in VB (general question)
    ... > object is terminated go out of scope, and the memory is also released. ... But why are you saying it uses stack? ... I think we are dealing with heap memory here. ... "COM's IMalloc allocator: ...
    (microsoft.public.vb.general.discussion)
  • Re: Linked List & Dynamic Memory Allocation
    ... Both of you mentioned stack and heap in this ... when I call malloc it uses heap to allocate memory. ... if you have an integer pointer object that lives beyond this scope and you had: ...
    (microsoft.public.vc.mfc)
  • Re: Stack, Heap, Mfc
    ... >> is put on the heap. ... >> decendant does this not mean that all memory will be on the heap because ... > stack or the heap. ... You first try to limit the recursion to an acceptable ...
    (microsoft.public.vc.mfc)

Quantcast