summaryrefslogtreecommitdiff
path: root/Kernel/Memory
diff options
context:
space:
mode:
authorcreator1creeper1 <creator1creeper1@airmail.cc>2022-01-08 20:06:03 +0100
committerLinus Groh <mail@linusgroh.de>2022-01-08 22:54:05 +0100
commit3c05261611ff210e26d14aabc75882b5dee23a61 (patch)
treea25e8cc63556bc6590873db68c96f8bb5dba2344 /Kernel/Memory
parenta7b70c62d776ed6262a158df26bb77a48f03be8a (diff)
downloadserenity-3c05261611ff210e26d14aabc75882b5dee23a61.zip
AK+Everywhere: Make FixedArray OOM-safe
FixedArray now doesn't expose any infallible constructors anymore. Rather, it exposes fallible methods. Therefore, it can be used for OOM-safe code. This commit also converts the rest of the system to use the new API. However, as an example, VMObject can't take advantage of this yet, as we would have to endow VMObject with a fallible static construction method, which would require a very fundamental change to VMObject's whole inheritance hierarchy.
Diffstat (limited to 'Kernel/Memory')
-rw-r--r--Kernel/Memory/VMObject.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Memory/VMObject.cpp b/Kernel/Memory/VMObject.cpp
index 7ccb723180..78db6f2d1b 100644
--- a/Kernel/Memory/VMObject.cpp
+++ b/Kernel/Memory/VMObject.cpp
@@ -18,13 +18,13 @@ SpinlockProtected<VMObject::AllInstancesList>& VMObject::all_instances()
}
VMObject::VMObject(VMObject const& other)
- : m_physical_pages(other.m_physical_pages)
+ : m_physical_pages(other.m_physical_pages.must_clone_but_fixme_should_propagate_errors())
{
all_instances().with([&](auto& list) { list.append(*this); });
}
VMObject::VMObject(size_t size)
- : m_physical_pages(ceil_div(size, static_cast<size_t>(PAGE_SIZE)))
+ : m_physical_pages(FixedArray<RefPtr<PhysicalPage>>::must_create_but_fixme_should_propagate_errors(ceil_div(size, static_cast<size_t>(PAGE_SIZE))))
{
all_instances().with([&](auto& list) { list.append(*this); });
}