'Memory leak' fix.
Summary: Memgraph seemed like it leaked memory while in fact it was just keeping it close by. By forcing release of free memory on top of heap back to the operating system we are making sure we are not using more memory than we have to in any given moment. Reviewers: mferencevic, buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D385
This commit is contained in:
parent
97638d3327
commit
aa6601407d
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "mvcc/id.hpp"
|
||||
@ -48,6 +50,12 @@ class DeferredDeleter {
|
||||
++it;
|
||||
}
|
||||
objects_.erase(objects_.begin(), it);
|
||||
// After deleting objects - to force release of now deleted (free) memory
|
||||
// back to OS we need to call malloc_trim. This will force memgraph to
|
||||
// return memory from top of the heap to OS. If we don't use this, it seems
|
||||
// to the outside observer we are leaking memory while in fact we are not,
|
||||
// we were just keeping it close by in case we need it in near future.
|
||||
malloc_trim(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user