summaryrefslogtreecommitdiff
path: root/Kernel/MemoryManager.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-08 16:40:48 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-08 16:40:48 +0100
commitd4ba15571105723e2bf8120e5cf8ca440261029c (patch)
tree481795f9c7f62ae8aa24636f694fa24767f48239 /Kernel/MemoryManager.h
parente1be5a468dece00603de4722d50916b21d2a83e8 (diff)
downloadserenity-d4ba15571105723e2bf8120e5cf8ca440261029c.zip
Kernel: Break retain cycle between Inode and VMObject.
There's no need for an Inode to keep its corresponding VMObject alive. Obviously there are huge benefits to keeping a filesystem cache, but leaking everything is hardly the right strategy. :^)
Diffstat (limited to 'Kernel/MemoryManager.h')
-rw-r--r--Kernel/MemoryManager.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Kernel/MemoryManager.h b/Kernel/MemoryManager.h
index b5974c3d67..a7243d5b97 100644
--- a/Kernel/MemoryManager.h
+++ b/Kernel/MemoryManager.h
@@ -10,6 +10,7 @@
#include <AK/HashTable.h>
#include <AK/AKString.h>
#include <AK/Badge.h>
+#include <AK/Weakable.h>
#include <Kernel/VirtualFileSystem.h>
#define PAGE_ROUND_UP(x) ((((dword)(x)) + PAGE_SIZE-1) & (~(PAGE_SIZE-1)))
@@ -77,7 +78,7 @@ private:
HashMap<unsigned, RetainPtr<PhysicalPage>> m_physical_pages;
};
-class VMObject : public Retainable<VMObject> {
+class VMObject : public Retainable<VMObject>, public Weakable<VMObject> {
friend class MemoryManager;
public:
static RetainPtr<VMObject> create_file_backed(RetainPtr<Inode>&&);