Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Deallocation of static STL i.e. map (http://www.go4expert.com/forums/deallocation-static-stl-ie-map-t7003/)

vijay_choudhari 24Oct2007 17:55

Deallocation of static STL i.e. map
 
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

shabbir 24Oct2007 21:13

Re: Deallocation of static STL i.e. map
 
Moved to C-C++ forum for better responses.

DaWei 24Oct2007 22:03

Re: Deallocation of static STL i.e. map
 
Try using Valgrind, see if that gives you any info.


All times are GMT +5.5. The time now is 05:18.