I use 1.9.14 version of cppunit. Red Hat 4 Ent Edition. gcc version 3.4.3
I create two .so libraries. Sourcecode of them seems to be ok. When I run test independently like:
DllPluginTester [params] lib1.so
DllPluginTester [params] lib2.so
everything is fine, valgrind (debugger for memory leaks) does not detect any problems in my code.
However when I run it:
DllPluginTester [params] lib1.so lib2.so
I get segmentation fault error after running tests. Valgrind reports memory problems - when stl vector is freeing the memory.
Problem happens when destructor of the static class that is used by both .so is invoked. This class is compiled to the both .so.
Mentioned vector contains pointers to some dynamic objects. When I create memory leak, ie. do not delete this objects, I do not have the problem anymore. However I am not happy with this solution.
I guess it is stl and cpp unit compatibility issue.
Thanks in advance for any advices
kwarek
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On Windows (IIRC), the dynamically-loaded library that allocates the memory needs to be the one that frees it or you get heaps all crossed up. Might that be your problem here?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The same stuff doesn't report any errors on windows (compiled with .NET 2003). Each library frees its own dynamic objects (confirmed by valgrind). But I am afraid that sth is mixed when DllPluginTester loads two libraries.
Anyway thanks for advice
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I use 1.9.14 version of cppunit. Red Hat 4 Ent Edition. gcc version 3.4.3
I create two .so libraries. Sourcecode of them seems to be ok. When I run test independently like:
DllPluginTester [params] lib1.so
DllPluginTester [params] lib2.so
everything is fine, valgrind (debugger for memory leaks) does not detect any problems in my code.
However when I run it:
DllPluginTester [params] lib1.so lib2.so
I get segmentation fault error after running tests. Valgrind reports memory problems - when stl vector is freeing the memory.
Problem happens when destructor of the static class that is used by both .so is invoked. This class is compiled to the both .so.
Mentioned vector contains pointers to some dynamic objects. When I create memory leak, ie. do not delete this objects, I do not have the problem anymore. However I am not happy with this solution.
I guess it is stl and cpp unit compatibility issue.
Thanks in advance for any advices
kwarek
On Windows (IIRC), the dynamically-loaded library that allocates the memory needs to be the one that frees it or you get heaps all crossed up. Might that be your problem here?
The same stuff doesn't report any errors on windows (compiled with .NET 2003). Each library frees its own dynamic objects (confirmed by valgrind). But I am afraid that sth is mixed when DllPluginTester loads two libraries.
Anyway thanks for advice