Thread: What fgures into my stack size? heap?

  1. #1
    Super Moderator
    Join Date
    Sep 2001

    What fgures into my stack size? heap?

    How do I figure out how large my programs stack is? What do I add up for memory, what else goes in, etc.... What about the heap? I need this to specify the sizes of these in my Module Definition for a Windows program.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Your programs stack size is not really fixed. When you call a function, you use more stack space, if that function calls a function, more, and so on. Recursive functions can grow a large stack. On most OS's, Windows included, there is a minimum stack size but it dynamically grows to suit.

    Heap depends on how much dynamic memory you have allocated. Windows implements a flat 32 bit addressing scheme. Your program is thus limited to 4G. Your heap and stack are in there, along with your code and a few other things. Memory is paged into and out of memory from the pagefile as necessary, (thus you do not need 4G of RAM to run a 4G program, just a big pagefile).

    You should not need this information up front to write a Windows program.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Confused about Memory
    By gL_nEwB in forum C++ Programming
    Replies: 22
    Last Post: 06-20-2006, 07:32 PM
  2. Stringy Sums
    By bumfluff in forum C++ Programming
    Replies: 14
    Last Post: 05-15-2006, 01:52 AM
  3. Trouble with DMA Segmentation Faults
    By firestorm717 in forum C Programming
    Replies: 2
    Last Post: 05-07-2006, 09:20 PM
  4. Rough cut stack manipulation
    By Thantos in forum C Programming
    Replies: 7
    Last Post: 04-02-2004, 12:49 PM
  5. stack make file problem
    By puckett_m in forum C Programming
    Replies: 2
    Last Post: 11-22-2001, 11:51 AM