`template
bool PluginManager::IsLibraryLoaded(const std::string& class_name) {
int status = 0;
std::string base_class_name =
abi::__cxa_demangle(typeid(Base).name(), 0, 0, &status);
if (plugin_class_plugin_namemap.find({class_name, base_class_name}) ==
plugin_class_plugin_namemap.end()) {
// not found
return false;
}
std::string plugin_name =
plugin_class_plugin_namemap[{class_name, base_class_name}];
if (plugin_loadedmap.find(plugin_name) == plugin_loadedmap.end()) {
// not found
return false;
}
return plugin_loadedmap[plugin_name];
}`
as shown, a string obj constructed with a ptr returned by __cxa_demangle(), but never free.
and the string obj may not able to free this memory, who always destruct its own memory.
I'm curious if there is a memory leak here.
`template
bool PluginManager::IsLibraryLoaded(const std::string& class_name) {
int status = 0;
std::string base_class_name =
abi::__cxa_demangle(typeid(Base).name(), 0, 0, &status);
if (plugin_class_plugin_namemap.find({class_name, base_class_name}) ==
plugin_class_plugin_namemap.end()) {
// not found
return false;
}
std::string plugin_name =
plugin_class_plugin_namemap[{class_name, base_class_name}];
if (plugin_loadedmap.find(plugin_name) == plugin_loadedmap.end()) {
// not found
return false;
}
return plugin_loadedmap[plugin_name]; }` as shown, a string obj constructed with a ptr returned by __cxa_demangle(), but never free. and the string obj may not able to free this memory, who always destruct its own memory. I'm curious if there is a memory leak here.
many thanks for your reply.