Catch a stack overflow

Community Forums/General Help/Catch a stack overflow

Blitzplotter(Posted 2010) [#1]
Hi, I'm having a little bother with a stack overflow problem. Basically, I'm allowing the user to create over a 1000 things which Blitz has to move. How can you catch when the stack is overflowing - is this possible ?


slenkar(Posted 2010) [#2]
hmmmmmmmmmmmmm
difficult one, jedive will probly know


Gabriel(Posted 2010) [#3]
I'm not really seeing the link between creating 1000 things and a stack overflow. If the "things" are objects, only a pointer is created on the stack. The objects themselves are on the heap. So you should really only be looking at 4KB out of 1MB(?) of stack space with 1000 objects.

Are you sure you're not running into an infinite loop or infinite recursion situation?


Blitzplotter(Posted 2010) [#4]
Hmm, at Gabriel - I'd be surprised if this was the case due to the fact the stack overflow kicks in within my latest Postman Plat prototype where when I have 10 towers that conside of 140 cuboids, the animation of 10 towers * 4 blocks * 50 hifg can cause a stack overflow probelm. However, the same 10 towers, only(?) 35 blocks high do not cause a stack overflow problem.

If there was an infintie loop or recursion problem I would have thought it'd be there whether the towers were 5 or 50 tall ?

Current prototype available here, you can modify how high the tower is via the GUI at start up:

Click here for installer


D4NM4N(Posted 2010) [#5]
I dont think you can. Are you sure there is no deep recursion? Im sure i have had 1000s of objects before now when doing non-rt rendering and not had a -stack- overflow before.
However if you mean the objects are nested 1000 levels deep, then perhaps it is time for a design change ;D

Are you using max or 3d? if it is max there are not any encapulated fields or methods calling each other repeatedly is there? (usually the reason i get s.o. errors :D)


VIP3R(Posted 2010) [#6]
It's ODE that's giving you the stack overflow. It happens when too many objects are colliding or overlapping during a single simulation step.

Each box collision generates multiple collision contacts so when you stack 1000s of boxes, they generate enormous amounts of collision contacts in total.

Using a different type of 'space' can help, for example using SimpleSpace instead of HashSpace. Adding each tower into its own sub-space may also help.


Blitzplotter(Posted 2010) [#7]
@VIP3R, thanks for the feedback. I appreciate the enormous amount of collisions that must have to be computated and will adjust my demo accordingly to compensate for the limits I am stretching things too.

I'll have a look at incorporating your suggestion, as in someone elses sig, if there is a problem there must be a solution, or something lioke that (;-)