1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2019-02-08 16:40:48 +01:00
parent e1be5a468d
commit d4ba155711
4 changed files with 9 additions and 9 deletions

View file

@ -14,6 +14,7 @@
#include <AK/Function.h>
#include <AK/kstdio.h>
#include <AK/Lock.h>
#include <AK/WeakPtr.h>
static const dword mepoch = 476763780;
@ -103,7 +104,7 @@ public:
void will_be_destroyed();
void set_vmo(RetainPtr<VMObject>&&);
void set_vmo(VMObject&);
VMObject* vmo() { return m_vmo.ptr(); }
const VMObject* vmo() const { return m_vmo.ptr(); }
@ -118,7 +119,7 @@ protected:
private:
FS& m_fs;
unsigned m_index { 0 };
RetainPtr<VMObject> m_vmo;
WeakPtr<VMObject> m_vmo;
bool m_metadata_dirty { false };
};