Deallocation of static STL i.e. map

vijay_choudhari's Avatar, Join Date: Oct 2007
Newbie 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
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Moved to C-C++ forum for better responses.
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Try using Valgrind, see if that gives you any info.