Deallocation of static STL i.e. map

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

  1. vijay_choudhari

    vijay_choudhari New Member

    Joined:
    Oct 24, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Moved to C-C++ forum for better responses.
     
  3. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    Try using Valgrind, see if that gives you any info.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice