diff options
Diffstat (limited to 'deimos/core/allocator.cpp')
-rw-r--r-- | deimos/core/allocator.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/deimos/core/allocator.cpp b/deimos/core/allocator.cpp index 1a823c1..b42861c 100644 --- a/deimos/core/allocator.cpp +++ b/deimos/core/allocator.cpp @@ -8,8 +8,8 @@ namespace deimos class SystemAllocatorImpl : public IAllocator
{
public:
- void* Reallocate(
- void* old_ptr, int64_t /* old_size */, int64_t new_size,
+ gsl::owner<void*> Reallocate(
+ gsl::owner<void*> old_ptr, int64_t /* old_size */, int64_t new_size,
MemoryScope /* scope */, const SourceLocation& /* source_location */) override
{
if (old_ptr == nullptr)
@@ -44,13 +44,15 @@ public: system = &m_system;
}
- Allocator* CreateChild(Allocator* parent, gsl::czstring /* description */) override
+ gsl::owner<Allocator*> CreateChild(Allocator* parent, gsl::czstring /* description */) override
{
- return parent;
+ return parent->New<Allocator>(parent->allocator(), MemoryScope{});
}
- void DestroyChild(Allocator*) override
+ void DestroyChild(gsl::owner<Allocator*> allocator) override
{
+ deimos_StaticAssert(std::is_trivially_destructible_v<Allocator>);
+ allocator->Delete(allocator);
}
};
|