Allen Bierbaum wrote:
> I am running into a very strange intermittent bug where it looks like
> OpenSG may be getting a system exception (possibly failed new or
> something similar) deep in the middle of a render traversal and then
> ends up with stack overflows in OpenGL because the state doesn't get
> reset correctly after the exception.

I don't see how that could happen, unless there was an OpenSG-object on 
the stack that affects OpenGL state, _and_ the exception was silently 
swallowed by you or someone else.

> I am just theorizing here, I still need to track it down more, but I
> wanted to ask the question.

Most debuggers can break on exceptions thrown, even if they are handled. 
(I know VS can). Try setting it to trigger on std::bad_alloc and see 
what happens

> If this happens, if OpenSG gets an exception doing in some render
> code, does it do anything to clean up the OpenGL state machine?  For
> example will it pop the matrix stack back to the same size it was
> before starting the render, same thing with the other stacks and the
> rendering state.

OpenSG is very exception-unsafe IIRC.

An app/lib should use the nothrow form of new if one doesn't handle 
std::bad_alloc exceptions, but most apps/libs (including OpenSG) doesn't 
try to hande and recover from out-of-memory conditions, as it is quite 
tricky, so the current situation is understandable.

> If not, does anyone know how to do this or have any sample code for doing 
> this?

std::set_new_handler can be used to set a callback that is called in 
event of an out-of-memory condition. That would probably be a good idea, 
although you can't do more than just pop up a dialog and terminate().

If one would patch OpenSG to detect probable causes for memory-alloc 
fail and terminate/cleanup the traversal and opensg state in those 
cases, it'd be pretty cool. However, it's a man-month or two probably.

Cheers,
/Marcus


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to