1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Deallocation of static STL i.e. map

Discussion in 'C' started by vijay_choudhari, Oct 24, 2007.

  1. vijay_choudhari

    vijay_choudhari New Member

    I am getting coredump on linux (Red Hat 3.4.6-8).

    I am using gcc (GCC) 3.4.6 20060404 compiler.

    The problem is I have used a static map inside a function (making the map local to the function). This function is in libStreet.so Now at run time another host application is loading this XYZ.so, using it and then unloading it.Everything works fine,But when host application closes[i.e. exits] It is giving coredump.If I change static map to static vector then it works fine[no coredump while closing host application.].

    I know that the static variables get deallocated after exiting from main() of host application, please let me know if my understanding is correct.

    In my case host application crashes after exiting main, however replacing the map with a vector solves the problem. Can anyone please help on this issue, Thanks.

    Please note that the same code works fine on Sun Solaris, gcc <> version
  2. shabbir

    shabbir Administrator Staff Member

    Moved to C-C++ forum for better responses.
  3. DaWei

    DaWei New Member

    Try using Valgrind, see if that gives you any info.

Share This Page