[*] RequestHeapOfRegion should take a memory view

This commit is contained in:
Reece Wilson 2024-02-13 03:55:57 +00:00
parent 39ba32df3c
commit 8b64a97514
3 changed files with 10 additions and 4 deletions

View File

@ -436,7 +436,7 @@ namespace Aurora::Memory
*/
AUKN_SHARED_API(AllocHeap, Heap, AuUInt uLength);
AUKN_SHARED_API(RequestHeapOfRegion, Heap, void *pPtr, AuUInt uLength);
AUKN_SHARED_API(RequestHeapOfRegion, Heap, const MemoryViewWrite &memory);
// AllocHeap but use mimalloc (or the default allocator) instead
AUKN_SHARED_API(AllocHeapMimalloc, Heap, AuUInt uLength);

View File

@ -17,9 +17,9 @@ namespace Aurora::Memory
}
#include "MemRef.hpp"
#include "MemoryView.hpp"
#include "HeapStats.hpp"
#include "Heap.hpp"
#include "MemoryView.hpp"
#include "Cache.hpp"
#include "SwapLock.hpp"

View File

@ -395,15 +395,21 @@ namespace Aurora::Memory
static_cast<InternalHeap *>(heap)->RequestTermination();
}
AUKN_SYM Heap *RequestHeapOfRegionNew(void *ptr, AuUInt size)
AUKN_SYM Heap *RequestHeapOfRegionNew(const MemoryViewWrite &memory)
{
if (!memory)
{
SysPushErrorArg();
return nullptr;
}
auto heap = _new InternalHeap();
if (!heap)
{
return nullptr;
}
if (!heap->Init(size, ptr))
if (!heap->Init(memory.length, memory.ptr))
{
delete heap;
return nullptr;