Add some instrumentation for debugging GC leaks
This commit is contained in:
@@ -230,6 +230,8 @@ EvalState::EvalState(const Strings & _searchPath)
|
||||
|
||||
EvalState::~EvalState()
|
||||
{
|
||||
fileEvalCache.clear();
|
||||
printCanaries();
|
||||
}
|
||||
|
||||
|
||||
@@ -1464,4 +1466,24 @@ void EvalState::printStats()
|
||||
}
|
||||
|
||||
|
||||
void EvalState::printCanaries()
|
||||
{
|
||||
#if HAVE_BOEHMGC
|
||||
if (!settings.get("debug-gc", false)) return;
|
||||
|
||||
GC_gcollect();
|
||||
|
||||
if (gcCanaries.empty()) {
|
||||
printMsg(lvlError, "all canaries have been garbage-collected");
|
||||
return;
|
||||
}
|
||||
|
||||
printMsg(lvlError, "the following canaries have not been garbage-collected:");
|
||||
|
||||
for (auto i : gcCanaries)
|
||||
printMsg(lvlError, format(" %1%") % i->string.s);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user