944,089 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1712
  • C RSS
Sep 23rd, 2004
0

possibly ignorant question about the stack

Expand Post »
What I'd like to know is if there is a way to tell how much space I have available in the stack and put that size into a variable.
ie long x = [stacksize]

I think I may have a poor understanding of how memory management works, so forgive me if this is a silly question. the problem I'm trying to solve is that a program crashes mysteriously after running for awhile, and my guess is that I'm doing something bad with copying objects, so it fills up the stack. If I can see how much room there is over time, I can tell if that is happening.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
elspork is offline Offline
4 posts
since Sep 2004
Sep 23rd, 2004
0

Re: possibly ignorant question about the stack

stack space is managed by the compiler, and usually if you have problems its becuase you recurse too deep and blow out the stack, but that's often pretty obvious.

Copying objects can cause you do do bad things with HEAP space (new/delete) if you have allocated space in the object and you don't have good copy constructors.

can you post some code?
Reputation Points: 36
Solved Threads: 11
Posting Pro in Training
Chainsaw is offline Offline
436 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Thank you Everyone
Next Thread in C Forum Timeline: dividing class implementation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC