Leak Units when memory profiling to prevent cleanup of Funcs and Classes

Memory profiling is going to rely on these things not getting
destroyed, so we are intentionally going to leak them in this case.
The use case of this is that the memory profiler is going to store
a stack trace as a bunch of SrcKeys, which can be used with D892173
to look up the original Func the stack trace goes through. Since we are
looking up the Func potentially much later than the SrcKey was
originally recorded, there is no guarantee that the Func will still be
around, or that we won't grab a pointer to it only to find that it is
in the middle of destructing and is thus full of garbage.
Esse commit está contido em:
Eric Caruso
2013-07-24 14:12:57 -07:00
commit de Sara Golemon
commit 8ac589b4b7
+1 -1
Ver Arquivo
@@ -58,7 +58,7 @@ PhpFile::PhpFile(const string &fileName, const string &srcRoot,
PhpFile::~PhpFile() {
always_assert(getRef() == 0);
if (m_unit != nullptr) {
if (!memory_profiling && m_unit != nullptr) {
// Deleting a Unit can grab a low-ranked lock and we're probably
// at a high rank right now
PendQ::defer(new DeferredDeleter<Unit>(m_unit));