Skip to main content
gamedev.net
🔒 Locked

Stack

Started by jonbell Feb 24, 2003 at 12:50 PM 1 replies 150+ views
Original Post
jonbell
jonbell
How big is the hardware runtime stack on modern CPU''s?
Jan Wassenberg
Jan Wassenberg
Modern CPU?
On x86, the stack is just a piece of memory that happens to be referenced by ss:esp.
An .exe can specify the amount of stack space it needs; the OS can dynamically grow the stack (=> not all of the mem needs to be committed immediately; accessing the last ("guard") page results in a page fault (''cause the OS marked it ''not present''), and more memory is allocated).

Doesn''t really make sense to speak of a ''hardware runtime stack''. Did you mean cache?

500x1
E8 17 00 42 CE DC D2 DC E4 EA C4 40 CA DA C2 D8 CC 40 CA D0 E8 40E0 CA CA 96 5B B0 16 50 D7 D4 02 B2 02 86 E2 CD 21 58 48 79 F2 C3
LessBread
LessBread
What Jan wrote is correct. This is meant to flesh out his comment a little more and answer the question about the stack size without reference to the confusion over hardware.

According to Jeff Richter''s book "Advanced Windows" (aka "Programming Applications"), the default stack size for a windows program compiled with MSVC is 1 Mb of address space plus two pages of committed memory. The size of the stack can be altered at compile time through the use of the /STACK switch.

/STACK:reserve[,commit]
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.