Thread: Stack usage

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    30

    Stack usage

    Hi.
    I would like to know exactly how much stack my program needs. I have been told that I can start by making the stack excessively large, fill it with a certain pattern, like AAAAAAAA, and after running the program see up to which address the pattern is not overwritten.

    My problem is to find a way to access the content of the stack memory section.

    I have tried declaring a void pointer in main, and then by the end of the mainfunction, accessing the stack area via the watch window. In the value column of the watch window it says: "Cannot load from non/primitive location", when I attemt to access a stack address

    My IDE is Code Composer Studio 3.1.

    Can anyone help me on this one?

    Thanks,
    Esben.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >My IDE is Code Composer Studio 3.1.
    Doesn't that have a memory browser?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    30
    >Doesn't that have a memory browser?
    Dont think so... It has a "symbol browser", but that only shows what in what address my stack is allocated.

    My option right now, is to step through the code and then keep track of the stack pointer, to see where is is lowest. I am looking for a more elegant way though...

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    I googled a manual, and it mentions a Memory Window in section 5.2.6. It's been many years, but it seems to me this was there in v1.x ('cuz I was looking at a memory window quite often).
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    30
    I found it, thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stack and pointer problem
    By ramaadhitia in forum C Programming
    Replies: 2
    Last Post: 09-11-2006, 11:41 PM
  2. infix evaluation using stack
    By lewissi in forum C++ Programming
    Replies: 0
    Last Post: 11-03-2005, 02:56 AM
  3. Question about a stack using array of pointers
    By Ricochet in forum C++ Programming
    Replies: 6
    Last Post: 11-17-2003, 10:12 PM
  4. error trying to compile stack program
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-03-2003, 06:27 PM
  5. Stack Program Here
    By Troll_King in forum C Programming
    Replies: 7
    Last Post: 10-15-2001, 05:36 PM