1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +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

@ -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>&&);