diff --git a/Source/Engine/Core/Memory/Allocation.cpp b/Source/Engine/Core/Memory/Allocation.cpp index 87c9dbc63..59b3a8a7e 100644 --- a/Source/Engine/Core/Memory/Allocation.cpp +++ b/Source/Engine/Core/Memory/Allocation.cpp @@ -14,6 +14,9 @@ void ArenaAllocator::Free() Allocator::Free(page); page = next; } + + // Unlink + _first = nullptr; } void* ArenaAllocator::Allocate(uint64 size, uint64 alignment) @@ -31,14 +34,14 @@ void* ArenaAllocator::Allocate(uint64 size, uint64 alignment) page->Memory = Allocator::Allocate(pageSize); page->Next = _first; page->Offset = 0; - page->Size = pageSize; + page->Size = (uint32)pageSize; _first = page; } // Allocate within a page page->Offset = Math::AlignUp(page->Offset, (uint32)alignment); void* mem = (byte*)page->Memory + page->Offset; - page->Offset += size; + page->Offset += (uint32)size; return mem; } \ No newline at end of file diff --git a/Source/Engine/Scripting/ManagedCLR/MCore.cpp b/Source/Engine/Scripting/ManagedCLR/MCore.cpp index 4ded56b52..675e09ddf 100644 --- a/Source/Engine/Scripting/ManagedCLR/MCore.cpp +++ b/Source/Engine/Scripting/ManagedCLR/MCore.cpp @@ -143,6 +143,7 @@ void MAssembly::Unload(bool isReloading) #else _classes.ClearDelete(); #endif + Memory.Free(); Unloaded(this); }