mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 15:44:57 +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:
parent
e1be5a468d
commit
d4ba155711
4 changed files with 9 additions and 9 deletions
|
@ -667,7 +667,7 @@ RetainPtr<VMObject> VMObject::create_file_backed(RetainPtr<Inode>&& inode)
|
|||
if (inode->vmo())
|
||||
return static_cast<VMObject*>(inode->vmo());
|
||||
auto vmo = adopt(*new VMObject(move(inode)));
|
||||
vmo->inode()->set_vmo(vmo.ptr());
|
||||
vmo->inode()->set_vmo(*vmo);
|
||||
return vmo;
|
||||
}
|
||||
|
||||
|
@ -732,10 +732,8 @@ VMObject::VMObject(RetainPtr<Inode>&& inode)
|
|||
|
||||
VMObject::~VMObject()
|
||||
{
|
||||
if (m_inode) {
|
||||
if (m_inode)
|
||||
ASSERT(m_inode->vmo() == this);
|
||||
m_inode->set_vmo(nullptr);
|
||||
}
|
||||
MM.unregister_vmo(*this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue