What fgures into my stack size? heap?

This is a discussion on What fgures into my stack size? heap? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; How do I figure out how large my programs stack is? What do I add up for memory, what else ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    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
    Posts
    4,831
    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, 08:32 PM
  2. Stringy Sums
    By bumfluff in forum C++ Programming
    Replies: 14
    Last Post: 05-15-2006, 02:52 AM
  3. Trouble with DMA Segmentation Faults
    By firestorm717 in forum C Programming
    Replies: 2
    Last Post: 05-07-2006, 10: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21