Test leaks if we run
tools/lldb/unittests/Host/HostTests without --gtest_filter
Details
Details
- Reviewers
shafik JDevlieghere labath teemperor - Commits
- rGf3f904563ec9: [lldb] Fix leak in test
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
I think we should instead implement the Terminate function that the plugin system provides to tear down our state. I made a patch in D104093 that
moves the once_flags to the internal state struct, so with a proper Terminate implementation + my patch this should all work properly.
HostInfoLinux::Terminate() { assert(g_fields && "Missing call to Initialize?"); delete g_fields; g_fields = nullptr; HostInfoBase::Terminate(); }
lldb/source/Host/linux/HostInfoLinux.cpp | ||
---|---|---|
41 | Please instead add a HostInfoLinux::Terminate() function that deletes and zeroes g_fields (see HostInfoBase::Terminate). Initialize -> Terminate should set up and tear down the data structures if possible (not saying that LLDB is doing this consistently at the moment, but that's the idea at least). |
lldb/unittests/Host/HostInfoTest.cpp | ||
---|---|---|
64 | HostInfoTestInitialization maybe? |
Please instead add a HostInfoLinux::Terminate() function that deletes and zeroes g_fields (see HostInfoBase::Terminate). Initialize -> Terminate should set up and tear down the data structures if possible (not saying that LLDB is doing this consistently at the moment, but that's the idea at least).