[PATCH] D83372: Fix for memory leak reported by Valgrind
Chris Lattner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 24 08:39:36 PDT 2020
lattner added a comment.
Some thoughts:
- Nit: you only need to call getManagedStaticMutex() once.
- I would also recommend resetting the `ManagedStaticMutex` pointer to null after deleting the mutex to help with scary dangling pointer bugs.
- Since you're deleting the mutex, then by definition this can only be called when there is a single thread touching LLVM. Please document this in the public header. This also means you don't have to acquire the mutex at all.
What happens when someone creates a new managed static after this? This should work. Can you reset the `mutex_init_flag` somehow?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83372/new/
https://reviews.llvm.org/D83372
More information about the llvm-commits
mailing list