Re: [osg-users] referenced memory management across dlls/exe (Windows only)

2015-03-01 Thread Trajce Nikolov NICK
Thanks Sergey. I found that too.

The problem was that the a core lib was keeping a ref_ptr of an Object
allocated by a plugin from a dll. Then on clean I got this problem. I
solved it by changing the ref_ptr to observer_ptr in the core lib. So I am
good now. But BIG thanks for helping me. Ulrich, thanks too.

Nick

p.s. I was Windows programmer for a decade and switched to Linux recently.
What a difference :-). Very good dev experience on Linux

On Sun, Mar 1, 2015 at 10:00 PM, Sergey Kurdakov 
wrote:

> Hi Nick,
>
> after looking  some more I found that newer versions of Mingw switch to
> dynamic linking of libstd++ by default. so libstdc++-6.dll is a right lib.
>
> but as you have the same problems then I have no answer.
>
> Regards
> Sergey
>
> On Sun, Mar 1, 2015 at 5:16 PM, Trajce Nikolov NICK <
> trajce.nikolov.n...@gmail.com> wrote:
>
>> Hi Sergey,
>>
>> on my system with the latest from the Qt bundle I don't have the
>> libstdc++_s ... only libstdc++.a and libstdc++-6.dll . And I added
>> -lstdc++ and still getting the same issues. Any further hints?
>>
>> Thanks a lot
>>
>> Nick
>>
>> On Sun, Mar 1, 2015 at 1:07 PM, Trajce Nikolov NICK <
>> trajce.nikolov.n...@gmail.com> wrote:
>>
>>> Thanks Ulrich. That is what is going on
>>>
>>> Sergey, where this flags go in the .pro file, in* QMAKE_CXXFLAGS* or
>>> *LIBS* ?
>>>
>>> Thanks a bunch
>>>
>>> Nick
>>>
>>> On Sun, Mar 1, 2015 at 12:49 PM, Sergey Kurdakov >> > wrote:
>>>
 Hi

 To link   against shared libgcc, add -shared-libgcc
 to link  against shared libstdc++ add -lstdc++_s

 Regards
 Sergey


 On Sun, Mar 1, 2015 at 1:58 PM, Ulrich Hertlein 
 wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Hi Nick,
>
> On 28/02/2015 14:46, Trajce Nikolov NICK wrote:
> > I am facing a problem with memory clean-up when mixing the place of
> allocation across
> > dlls and the executable. Let say I have main executable that loads
> dlls (plugins) in
> > which I allocate memory using referenced pointers. On exit, those
> pointers that were
> > allocated in one of the dlls got stucked in ... If I clean these
> pointers from the
> > originated dll, it works ok, otherwise not.
> >
> > Any clue?
>
> You end up with different instances of the runtime library, each with
> its own heap
> management.  You allocate the object on the heap of one DLL and free
> it onto the heap of
> the other -> bang.
>
> Sorry, I don't know what the corresponding flag might be on mingw.
>
> Cheers,
> /ulrich
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1
>
> iQEcBAEBCAAGBQJU8vDIAAoJEP8WARS52jMYq6gH/Axcl3evhaF8tdjUePeHb707
> Et4rociiWaZdVu2Cq3x3TWr6MvOqqdcJMka1h7z0Nyy43FI0HI2s63NdPiXH5LcS
> BYC8j1w8BTzOisOUYyQJwGaqt4856ne2tHAjAU47Qp5bAsvbx7ZTZa0VU2ncLmJt
> A5P2TOtDRGBjtxoQc4Kmx33AWHFzX3iT+yaN5v6EUTVO3MReQTqWCXdJWr+/GC/0
> DMWmO/ZhGLis2NONoDGeNtZtgABPhg91Z+tZt0jYyzEkJ9eC4WN+F7x++0NPfRaf
> BBAzFN8Ch9YA4mcMjQF2TkqEdMcBHnmUb49ObUbU6fHd9Ce946dwfrB1gtlne4M=
> =Q7H0
> -END PGP SIGNATURE-
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


>>>
>>>
>>> --
>>> trajce nikolov nick
>>>
>>
>>
>>
>> --
>> trajce nikolov nick
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] referenced memory management across dlls/exe (Windows only)

2015-03-01 Thread Sergey Kurdakov
Hi Nick,

after looking  some more I found that newer versions of Mingw switch to
dynamic linking of libstd++ by default. so libstdc++-6.dll is a right lib.

but as you have the same problems then I have no answer.

Regards
Sergey

On Sun, Mar 1, 2015 at 5:16 PM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Hi Sergey,
>
> on my system with the latest from the Qt bundle I don't have the
> libstdc++_s ... only libstdc++.a and libstdc++-6.dll . And I added
> -lstdc++ and still getting the same issues. Any further hints?
>
> Thanks a lot
>
> Nick
>
> On Sun, Mar 1, 2015 at 1:07 PM, Trajce Nikolov NICK <
> trajce.nikolov.n...@gmail.com> wrote:
>
>> Thanks Ulrich. That is what is going on
>>
>> Sergey, where this flags go in the .pro file, in* QMAKE_CXXFLAGS* or
>> *LIBS* ?
>>
>> Thanks a bunch
>>
>> Nick
>>
>> On Sun, Mar 1, 2015 at 12:49 PM, Sergey Kurdakov 
>> wrote:
>>
>>> Hi
>>>
>>> To link   against shared libgcc, add -shared-libgcc
>>> to link  against shared libstdc++ add -lstdc++_s
>>>
>>> Regards
>>> Sergey
>>>
>>>
>>> On Sun, Mar 1, 2015 at 1:58 PM, Ulrich Hertlein 
>>> wrote:
>>>
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Hi Nick,

 On 28/02/2015 14:46, Trajce Nikolov NICK wrote:
 > I am facing a problem with memory clean-up when mixing the place of
 allocation across
 > dlls and the executable. Let say I have main executable that loads
 dlls (plugins) in
 > which I allocate memory using referenced pointers. On exit, those
 pointers that were
 > allocated in one of the dlls got stucked in ... If I clean these
 pointers from the
 > originated dll, it works ok, otherwise not.
 >
 > Any clue?

 You end up with different instances of the runtime library, each with
 its own heap
 management.  You allocate the object on the heap of one DLL and free it
 onto the heap of
 the other -> bang.

 Sorry, I don't know what the corresponding flag might be on mingw.

 Cheers,
 /ulrich
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1

 iQEcBAEBCAAGBQJU8vDIAAoJEP8WARS52jMYq6gH/Axcl3evhaF8tdjUePeHb707
 Et4rociiWaZdVu2Cq3x3TWr6MvOqqdcJMka1h7z0Nyy43FI0HI2s63NdPiXH5LcS
 BYC8j1w8BTzOisOUYyQJwGaqt4856ne2tHAjAU47Qp5bAsvbx7ZTZa0VU2ncLmJt
 A5P2TOtDRGBjtxoQc4Kmx33AWHFzX3iT+yaN5v6EUTVO3MReQTqWCXdJWr+/GC/0
 DMWmO/ZhGLis2NONoDGeNtZtgABPhg91Z+tZt0jYyzEkJ9eC4WN+F7x++0NPfRaf
 BBAzFN8Ch9YA4mcMjQF2TkqEdMcBHnmUb49ObUbU6fHd9Ce946dwfrB1gtlne4M=
 =Q7H0
 -END PGP SIGNATURE-
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

>>>
>>>
>>> ___
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>>
>> --
>> trajce nikolov nick
>>
>
>
>
> --
> trajce nikolov nick
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] referenced memory management across dlls/exe (Windows only)

2015-03-01 Thread Trajce Nikolov NICK
Hi Sergey,

on my system with the latest from the Qt bundle I don't have the
libstdc++_s ... only libstdc++.a and libstdc++-6.dll . And I added
-lstdc++ and still getting the same issues. Any further hints?

Thanks a lot

Nick

On Sun, Mar 1, 2015 at 1:07 PM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Thanks Ulrich. That is what is going on
>
> Sergey, where this flags go in the .pro file, in* QMAKE_CXXFLAGS* or
> *LIBS* ?
>
> Thanks a bunch
>
> Nick
>
> On Sun, Mar 1, 2015 at 12:49 PM, Sergey Kurdakov 
> wrote:
>
>> Hi
>>
>> To link   against shared libgcc, add -shared-libgcc
>> to link  against shared libstdc++ add -lstdc++_s
>>
>> Regards
>> Sergey
>>
>>
>> On Sun, Mar 1, 2015 at 1:58 PM, Ulrich Hertlein 
>> wrote:
>>
>>> -BEGIN PGP SIGNED MESSAGE-
>>> Hash: SHA256
>>>
>>> Hi Nick,
>>>
>>> On 28/02/2015 14:46, Trajce Nikolov NICK wrote:
>>> > I am facing a problem with memory clean-up when mixing the place of
>>> allocation across
>>> > dlls and the executable. Let say I have main executable that loads
>>> dlls (plugins) in
>>> > which I allocate memory using referenced pointers. On exit, those
>>> pointers that were
>>> > allocated in one of the dlls got stucked in ... If I clean these
>>> pointers from the
>>> > originated dll, it works ok, otherwise not.
>>> >
>>> > Any clue?
>>>
>>> You end up with different instances of the runtime library, each with
>>> its own heap
>>> management.  You allocate the object on the heap of one DLL and free it
>>> onto the heap of
>>> the other -> bang.
>>>
>>> Sorry, I don't know what the corresponding flag might be on mingw.
>>>
>>> Cheers,
>>> /ulrich
>>> -BEGIN PGP SIGNATURE-
>>> Version: GnuPG v1
>>>
>>> iQEcBAEBCAAGBQJU8vDIAAoJEP8WARS52jMYq6gH/Axcl3evhaF8tdjUePeHb707
>>> Et4rociiWaZdVu2Cq3x3TWr6MvOqqdcJMka1h7z0Nyy43FI0HI2s63NdPiXH5LcS
>>> BYC8j1w8BTzOisOUYyQJwGaqt4856ne2tHAjAU47Qp5bAsvbx7ZTZa0VU2ncLmJt
>>> A5P2TOtDRGBjtxoQc4Kmx33AWHFzX3iT+yaN5v6EUTVO3MReQTqWCXdJWr+/GC/0
>>> DMWmO/ZhGLis2NONoDGeNtZtgABPhg91Z+tZt0jYyzEkJ9eC4WN+F7x++0NPfRaf
>>> BBAzFN8Ch9YA4mcMjQF2TkqEdMcBHnmUb49ObUbU6fHd9Ce946dwfrB1gtlne4M=
>>> =Q7H0
>>> -END PGP SIGNATURE-
>>> ___
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
>
> --
> trajce nikolov nick
>



-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] referenced memory management across dlls/exe (Windows only)

2015-03-01 Thread Trajce Nikolov NICK
Thanks Ulrich. That is what is going on

Sergey, where this flags go in the .pro file, in* QMAKE_CXXFLAGS* or *LIBS*
?

Thanks a bunch

Nick

On Sun, Mar 1, 2015 at 12:49 PM, Sergey Kurdakov 
wrote:

> Hi
>
> To link   against shared libgcc, add -shared-libgcc
> to link  against shared libstdc++ add -lstdc++_s
>
> Regards
> Sergey
>
>
> On Sun, Mar 1, 2015 at 1:58 PM, Ulrich Hertlein 
> wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA256
>>
>> Hi Nick,
>>
>> On 28/02/2015 14:46, Trajce Nikolov NICK wrote:
>> > I am facing a problem with memory clean-up when mixing the place of
>> allocation across
>> > dlls and the executable. Let say I have main executable that loads dlls
>> (plugins) in
>> > which I allocate memory using referenced pointers. On exit, those
>> pointers that were
>> > allocated in one of the dlls got stucked in ... If I clean these
>> pointers from the
>> > originated dll, it works ok, otherwise not.
>> >
>> > Any clue?
>>
>> You end up with different instances of the runtime library, each with its
>> own heap
>> management.  You allocate the object on the heap of one DLL and free it
>> onto the heap of
>> the other -> bang.
>>
>> Sorry, I don't know what the corresponding flag might be on mingw.
>>
>> Cheers,
>> /ulrich
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1
>>
>> iQEcBAEBCAAGBQJU8vDIAAoJEP8WARS52jMYq6gH/Axcl3evhaF8tdjUePeHb707
>> Et4rociiWaZdVu2Cq3x3TWr6MvOqqdcJMka1h7z0Nyy43FI0HI2s63NdPiXH5LcS
>> BYC8j1w8BTzOisOUYyQJwGaqt4856ne2tHAjAU47Qp5bAsvbx7ZTZa0VU2ncLmJt
>> A5P2TOtDRGBjtxoQc4Kmx33AWHFzX3iT+yaN5v6EUTVO3MReQTqWCXdJWr+/GC/0
>> DMWmO/ZhGLis2NONoDGeNtZtgABPhg91Z+tZt0jYyzEkJ9eC4WN+F7x++0NPfRaf
>> BBAzFN8Ch9YA4mcMjQF2TkqEdMcBHnmUb49ObUbU6fHd9Ce946dwfrB1gtlne4M=
>> =Q7H0
>> -END PGP SIGNATURE-
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] referenced memory management across dlls/exe (Windows only)

2015-03-01 Thread Sergey Kurdakov
Hi

To link   against shared libgcc, add -shared-libgcc
to link  against shared libstdc++ add -lstdc++_s

Regards
Sergey


On Sun, Mar 1, 2015 at 1:58 PM, Ulrich Hertlein 
wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Hi Nick,
>
> On 28/02/2015 14:46, Trajce Nikolov NICK wrote:
> > I am facing a problem with memory clean-up when mixing the place of
> allocation across
> > dlls and the executable. Let say I have main executable that loads dlls
> (plugins) in
> > which I allocate memory using referenced pointers. On exit, those
> pointers that were
> > allocated in one of the dlls got stucked in ... If I clean these
> pointers from the
> > originated dll, it works ok, otherwise not.
> >
> > Any clue?
>
> You end up with different instances of the runtime library, each with its
> own heap
> management.  You allocate the object on the heap of one DLL and free it
> onto the heap of
> the other -> bang.
>
> Sorry, I don't know what the corresponding flag might be on mingw.
>
> Cheers,
> /ulrich
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1
>
> iQEcBAEBCAAGBQJU8vDIAAoJEP8WARS52jMYq6gH/Axcl3evhaF8tdjUePeHb707
> Et4rociiWaZdVu2Cq3x3TWr6MvOqqdcJMka1h7z0Nyy43FI0HI2s63NdPiXH5LcS
> BYC8j1w8BTzOisOUYyQJwGaqt4856ne2tHAjAU47Qp5bAsvbx7ZTZa0VU2ncLmJt
> A5P2TOtDRGBjtxoQc4Kmx33AWHFzX3iT+yaN5v6EUTVO3MReQTqWCXdJWr+/GC/0
> DMWmO/ZhGLis2NONoDGeNtZtgABPhg91Z+tZt0jYyzEkJ9eC4WN+F7x++0NPfRaf
> BBAzFN8Ch9YA4mcMjQF2TkqEdMcBHnmUb49ObUbU6fHd9Ce946dwfrB1gtlne4M=
> =Q7H0
> -END PGP SIGNATURE-
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] referenced memory management across dlls/exe (Windows only)

2015-03-01 Thread Ulrich Hertlein
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hi Nick,

On 28/02/2015 14:46, Trajce Nikolov NICK wrote:
> I am facing a problem with memory clean-up when mixing the place of 
> allocation across
> dlls and the executable. Let say I have main executable that loads dlls 
> (plugins) in
> which I allocate memory using referenced pointers. On exit, those pointers 
> that were
> allocated in one of the dlls got stucked in ... If I clean these pointers 
> from the
> originated dll, it works ok, otherwise not.
> 
> Any clue?

You end up with different instances of the runtime library, each with its own 
heap
management.  You allocate the object on the heap of one DLL and free it onto 
the heap of
the other -> bang.

Sorry, I don't know what the corresponding flag might be on mingw.

Cheers,
/ulrich
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQEcBAEBCAAGBQJU8vDIAAoJEP8WARS52jMYq6gH/Axcl3evhaF8tdjUePeHb707
Et4rociiWaZdVu2Cq3x3TWr6MvOqqdcJMka1h7z0Nyy43FI0HI2s63NdPiXH5LcS
BYC8j1w8BTzOisOUYyQJwGaqt4856ne2tHAjAU47Qp5bAsvbx7ZTZa0VU2ncLmJt
A5P2TOtDRGBjtxoQc4Kmx33AWHFzX3iT+yaN5v6EUTVO3MReQTqWCXdJWr+/GC/0
DMWmO/ZhGLis2NONoDGeNtZtgABPhg91Z+tZt0jYyzEkJ9eC4WN+F7x++0NPfRaf
BBAzFN8Ch9YA4mcMjQF2TkqEdMcBHnmUb49ObUbU6fHd9Ce946dwfrB1gtlne4M=
=Q7H0
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] referenced memory management across dlls/exe (Windows only)

2015-02-28 Thread Trajce Nikolov NICK
also I am using Qt Creator and MinGW (whatever the last version is). I know
in Visual Studio you can specify the /MD option to use shared CRT libs and
to avoid this problem. Any MinGW gurus around with hints?

Nick

On Sat, Feb 28, 2015 at 2:46 PM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Hi all,
>
> I am facing a problem with memory clean-up when mixing the place of
> allocation across dlls and the executable. Let say I have main executable
> that loads dlls (plugins) in which I allocate memory using referenced
> pointers. On exit, those pointers that were allocated in one of the dlls
> got stucked in
>
> if (needDelete)
>
> {
>
> signalObserversAndDelete(true,true);
>
> }
>
>
> Ln 198 in Referenced. And this is Windows only, on Mac or Linux I don't have 
> this problem.
>
>
> If I clean these pointers from the originated dll, it works ok, otherwise not.
>
>
> Any clue?
>
>
> Thanks as allways!
>
>
> Nick
>
>
> --
> trajce nikolov nick
>



-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] referenced memory management across dlls/exe (Windows only)

2015-02-28 Thread Trajce Nikolov NICK
Hi all,

I am facing a problem with memory clean-up when mixing the place of
allocation across dlls and the executable. Let say I have main executable
that loads dlls (plugins) in which I allocate memory using referenced
pointers. On exit, those pointers that were allocated in one of the dlls
got stucked in

if (needDelete)

{

signalObserversAndDelete(true,true);

}


Ln 198 in Referenced. And this is Windows only, on Mac or Linux I
don't have this problem.


If I clean these pointers from the originated dll, it works ok, otherwise not.


Any clue?


Thanks as allways!


Nick


-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org