I have come across a class called Runtime in GENIVI/capicxx-core-runtime. Part of the code specified below.
class Runtime {
public:
COMMONAPI_EXPORT static std::shared_ptr<Runtime> get();
COMMONAPI_EXPORT Runtime();
COMMONAPI_EXPORT virtual ~Runtime()
private:
static std::shared_ptr<Runtime> theRuntime__;
};
std::shared_ptr<Runtime> Runtime::theRuntime__ = std::make_shared<Runtime>();
std::shared_ptr<Runtime> Runtime::get() {
return theRuntime__;
}
My doubt is with the theRuntime__ variable. Since shared_ptr does heap allocation, will the underlying object of theRuntime__ variable is allocated on heap in this scenario or is it allocated on BSS/DATA segment?
Aucun commentaire:
Enregistrer un commentaire