mirror of
https://github.com/usatiuk/psil.git
synced 2025-10-28 18:57:48 +01:00
cleanup memory on exit
This commit is contained in:
@@ -20,6 +20,15 @@ MemoryContext::MemoryContext() {
|
||||
}
|
||||
|
||||
MemoryContext::~MemoryContext() {
|
||||
// Three times because the first one might not start it as it's been running already
|
||||
// second one as it might skip something because something has been dirtied
|
||||
// and the third one everything should be cleaned
|
||||
request_gc_and_wait();
|
||||
request_gc_and_wait();
|
||||
request_gc_and_wait();
|
||||
|
||||
assert(cell_count() == 0);
|
||||
|
||||
MemoryContext *expected = this;
|
||||
if (!CURRENT_MC.compare_exchange_strong(expected, nullptr)) {
|
||||
std::cerr << "Global MC pointer was overwritten!" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user