Hello Pablo,

Pablo Carneiro Elias wrote:
> Hi, we're experiencing random access violations in our program under
> windows, and it seems to have something to do with OpenSG. We did this
> simple test:
> 
> int main( int argc, char *argv[] )
> {
>     bool init1 = OSG::osgInit( argc, argv );
>     bool exit1 = OSG::osgExit();
> 
>     bool init2 = OSG::osgInit( argc, argv );
>     bool exit2 = OSG::osgExit();
> 
>     return 0;
> }

sorry, but this tests does not allow many conclusions, because it is 
fully expected to fail. OpenSG makes use a lot of static initialization 
and (in order to reduce the amount of memory reported as being leaked) 
tries to clean that up during osgExit. So once you call osgExit a lot of 
the internal objects are lost and they can not be reocovered.

> This program crashes at the second osgExit() call. But if we comment this
> line, it crashes at the "return 0". If we comment the second osgInit(), then
> the program "works".

yes, the only surprise here is that it even makes it through osgInit ;)

> But in our real application we're experiencing a similar crash even though
> we only call osgInit() once (and don't even call osgExit()). If we remove
> nodes from the graph, the program will crash at random locations. I've
> already checked and both our program and OpenSG are use the same runtime
> libraries.
> 
> Looks like memory corruption. Any clues?!

that is a possibility, my general bet would be that you have objects in 
your scene that have actually been deleted already.
I'm really sorry but I don't know how to help you track this down other 
than that you might want to run a traversal over the scene that prints 
the reference count of the objects and look for those that have a zero 
there.
The reference count can be obtained by calling a member function of the 
pointer, i.e.

NodePtr p = Node::create();
p.getRefCount()  // note . instead of ->

        Hope it helps,
                Carsten


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to