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 (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath) version
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 declared and used static map[i.e. STL] inside a function.This function is in say XYZ.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 we change static map to static vector then it works fine[no coredump while closing host application.].
My questions are,
1.Exactly when static variables in XYZ.so gets deallocated[After unloading XYZ.so or after exiting from main() of host apllication].
2.STL grows at runtime if needed and variables marked as static gets space in .obj at compile time i.e. fixed amount of space[not absolute memory location but the offset].Then how does compiler handles allocation and deallocation of variables of type static STL[i.e. static map,vector,..].
3.In our case host application crashes after exiting main[after unloading XYZ.so].It means static map is getting destructed after exiting main.It conflicts with 2nd point[allocation of space for static variable in .obj]
4.Also if static variables which are from XYZ.so are getting destructed after exiting main() of host application and XYZ.so is already unloaded then how does host application gets access of the destructors of static type which are declared in XYZ.so .
Could anybody please help on this issue,Thanks in advance.