Heap & Stack Question

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi all,

following this link,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_.2f.HEAP_link.asp,
the msdn tells that the default heap size is 1 MB and can be set with
/HEAP:reserve[,commit] linker option.
On the same way, we can set the stack with /STACK:reserve[,commit],
which is 1MB too.

But, if i do an allocation : for example
int * t = new int[5000000];
this should be localized in the heap ? like if i use HeapAlloc (or
GlobalAlloc/LocalAlloc) ? But it's larger than 1MB ... Where is it
wrong ?

I thought on the same way, that something like this
int t[5000000];
is localized on the stack, how ? is-it right ?

And what about VirtualAlloc ?

I'm really not clear with that, i hope someone can makes me this
clearer


Thanks in advance

Nicolas H.

.



Relevant Pages

  • Port Win app to Linux Questions: Memory management and OEM Char
    ... local heap and global heap. ... MSDN: The GlobalAlloc function allocates the specified number of bytes ...
    (comp.unix.programmer)
  • Re: Heap & Stack Question
    ... > the msdn tells that the default heap size is 1 MB and can be set with ... if i do an allocation: ... > this should be localized in the heap? ... Yes, it will be allocated on the stack. ...
    (microsoft.public.vc.mfc)
  • Modify heap attributes of another process?
    ... how do i modify heap attributes of another process? ... I've found from msdn ways to enumerate processes and then getting heap ...
    (microsoft.public.win32.programmer.kernel)
  • Re: delete causes program to crash after upgrade to VS 7.1
    ... during memory allocation or deallocation are typically a result of the heap ... structure having been screwed up some considerable time earlier by some ... Tim Ward ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • More Markie Mularkie
    ... Not nearly as bad as the abuse you heap upon the English language, ... Markie. ... Prev by Date: ...
    (rec.radio.amateur.policy)