Hi Anders,

On 3/12/10 22:05 , Anders Backman wrote:
> This is a WINDOWS problem only.
> 
> ...
> To reply Juan, the problem of using static variables for destruction is that
> it causes exactly this problem :-)
> 
> If  the static variable is defined in the MAIN-APP, it works just fine. In
> the same way that atexit() works when it is called from the main-app.
> 
> It is when the static variable (in your case static Deallocator deallocator)
> is defined in the .dll file for our library the problem occurs.

I've always had problems with Windows applications that do this sort of thing, 
namely
allocating memory in one unit (dll/exe, for lack of a better word) and deleting 
it in another.

The way it was explained to me is that dll and exe have separate heap 
management, and so
allocating an object from one heap and returning it to another doesn't work.  I 
worked
around this by making sure that memory is always allocated/freed within the 
same unit.
Worst case this meant to move common functionality into a header file and 
duplicated the
code in both the exe and the dll.

But I seem to remember that by some compiler switches you can actually avoid 
this mess!
(Hear, Hear!)  I was somewhat surprised that MS haven't added debug code to 
check for this
by tracking where a piece of memory was allocated.

Is it possible this is the case in your application?

Cheers,
/ulrich
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to