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:
@@ -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));
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário