| | |
possibly ignorant question about the stack
![]() |
•
•
Join Date: Sep 2004
Posts: 4
Reputation:
Solved Threads: 0
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.
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.
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?
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?
![]() |
Similar Threads
- Stack overflow issue (C++)
- Implementing stack in maze (C++)
- Question (linked lists) (C++)
- stack and queues (C)
- Can anyone help me with this question?? (C++)
- Stack conversion (C++)
Other Threads in the C Forum
- Previous Thread: Thank you Everyone
- Next Thread: dividing class implementation
| Thread Tools | Search this Thread |
* adobe ansi api array arrays binarysearch calculate centimeter char character cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking highest homework i/o inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. lowest match matrix microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pattern pdf performance pointer posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h





