diff options
Diffstat (limited to 'Public/Kits/System.Core/Heap+Impl.cxx')
| -rw-r--r-- | Public/Kits/System.Core/Heap+Impl.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Public/Kits/System.Core/Heap+Impl.cxx b/Public/Kits/System.Core/Heap+Impl.cxx new file mode 100644 index 00000000..e3dcb11c --- /dev/null +++ b/Public/Kits/System.Core/Heap+Impl.cxx @@ -0,0 +1,37 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include <System.Core/Heap.hxx> +#include <System.Core/System.Core.hxx> + +using namespace System; + +Heap* Heap::Shared() noexcept { + static Heap* heap = nullptr; + + if (!heap) { + heap = new Heap(); + } + + return heap; +} + +void Heap::Delete(HeapPtr me) noexcept { + CA_MUST_PASS(me); + HcFreeProcessHeap(kInstanceObject, me); +} + +SizeT Heap::Size(HeapPtr me) noexcept { + CA_MUST_PASS(me); + return HcProcessHeapSize(kInstanceObject, me); +} + +HeapPtr Heap::New(const SizeT &sz, const Int32 flags) { + SizeT _sz = sz; + if (!_sz) ++_sz; + + return HcAllocateProcessHeap(kInstanceObject, _sz, flags); +}
\ No newline at end of file |
