ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
24.71k stars 9.62k forks source link

probably memory leak: abi::__cxa_demangle() #15448

Open xuwh9 opened 3 days ago

xuwh9 commented 3 days ago

`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.