Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in Tf_RegistryImpl #3088

Open
dtoshevcg opened this issue May 16, 2024 · 2 comments
Open

Memory leak in Tf_RegistryImpl #3088

dtoshevcg opened this issue May 16, 2024 · 2 comments

Comments

@dtoshevcg
Copy link

dtoshevcg commented May 16, 2024

Description of Issue

We are seeing a strange memory leak report when running a binary compiled with Clang's address sanitizer linked with USD v23.11. That is, our code is compiled with address sanitizer enabled, while USD is compiled in release mode using its own script and gcc 11. The error from ASAN is:

==1591245==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1544 byte(s) in 1 object(s) allocated from:
    #0 0x39ff87 in operator new(unsigned long)
    #1 0x7f54cf89fcd6 in std::vector<__gnu_cxx::_Hashtable_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::list<pxrInternal_v0_23__pxrReserved__::(anonymous namespace)::Tf_RegistryManagerImpl::_RegistrationValue, std::allocator<pxrInternal_v0_23__pxrReserved__::(anonymous namespace)::Tf_RegistryManagerImpl::_RegistrationValue> > > >*, std::allocator<__gnu_cxx::_Hashtable_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::list<pxrInternal_v0_23__pxrReserved__::(anonymous namespace)::Tf_RegistryManagerImpl::_RegistrationValue, std::allocator<pxrInternal_v0_23__pxrReserved__::(anonymous namespace)::Tf_RegistryManagerImpl::_RegistrationValue> > > >*> >::reserve(unsigned long) (.constprop.0) registryManager.cpp

From that I gather that the Tf_RegistryManagerImpl's _registrationFunctions member is not freed, which is strange, because the singleton instance itself is freed. The leak is always reproducible and doesn't require calling any USD functions beyond the DSO's initialisation.

Steps to Reproduce

  1. Run any binary compiled with Clang and address sanitizer, linked with USD v23.11 on Rocky 8.

System Information (OS, Hardware)

Rocky Linux 8

Package Versions

USD: v23.11
Compiler used for USD: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
Compiler used for our code: clang version 14.0.6

Build Flags

build_usd.py --build-variant=release --materialx --no-prman --no-tutorials --no-examples --no-docs --no-tools --no-python --use-cxx11-abi=1

Edit: fixed formatting

@jesschimein
Copy link
Contributor

Filed as internal issue #USD-9680

@dgovil
Copy link
Collaborator

dgovil commented Oct 31, 2024

Would I be correct in assuming that #3133 would fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants