Menu

Memory problems when using two .so libraries

Help
kwarek
2006-01-13
2013-04-22
  • kwarek

    kwarek - 2006-01-13

    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

     
    • Tom Plunket

      Tom Plunket - 2006-01-13

      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?

       
      • kwarek

        kwarek - 2006-01-13

        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

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.