BIG Memory Problems....
BIG Memory Problems....
(OP)
Helo,
im writing a simple raycasting engine, ive set up some memory in the program for a virtual screen which i flip to vga. it is all working fine, but after about a minute the program stops with error 200: stack overflow, i cant see why it would do this, as i am reusing most variable and reusing the memory for the screen by looping the program.
any ideas or solutions anyone?
thanks - DF
im writing a simple raycasting engine, ive set up some memory in the program for a virtual screen which i flip to vga. it is all working fine, but after about a minute the program stops with error 200: stack overflow, i cant see why it would do this, as i am reusing most variable and reusing the memory for the screen by looping the program.
any ideas or solutions anyone?
thanks - DF
RE: BIG Memory Problems....
Too many local variables in a recursive routine.
Recursion run wild.
A less likely but still possible cause is large local variables.
RE: BIG Memory Problems....
But I personally have a bias against recursion anyway.
LorenPechtel: as a matter of interest if you have time to answer, is there an outside tiny possibility that having a huge heap increases the chance of a stack overflow, because I have vague memories that the stack grows downwards into the same memory as the heap uses (upwards), so they can collide in the middle? If so, how does the run-time stuff decide who caused the error?? This hasn't happened to me, but I was just wondering....
RE: BIG Memory Problems....
This is Pascal's memory model:
HeapEnd --------------------------------------
| |
| Heap |
| |
HeapOrg --------------------------------------
| Overlay buffer |
SSeg --------------------------------------
| Stack |
SPtr --------------------------------------
| Data segment with global variables |
|====================================|
| Typed constants |
DSeg --------------------------------------
|Code segment of the run-time library|
|------------------------------------|
| Code segment unit A |
|------------------------------------|
| Other unit code segments |
|------------------------------------|
| Code segment unit E |
|------------------------------------|
| Code segment main program |
CSeg ======================================
| Program Segment Prefix (PSP) |
PrefixSeg --------------------------------------
As for large local variables, store them in heap memory in stead of in stack memory.
Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
http://student.vub.ac.be/~bvingerh/
Don't worry what people think about you. They're too busy wondering what you think about them.
RE: BIG Memory Problems....
RE: BIG Memory Problems....
Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
http://student.vub.ac.be/~bvingerh/
Don't worry what people think about you. They're too busy wondering what you think about them.
RE: BIG Memory Problems....
But maybe this changed in other versions of pascal.
RE: BIG Memory Problems....