diff --git a/source/lib/allocators/dynarray.cpp b/source/lib/allocators/dynarray.cpp index 6e0716e616..ec8fe9c365 100644 --- a/source/lib/allocators/dynarray.cpp +++ b/source/lib/allocators/dynarray.cpp @@ -109,7 +109,11 @@ Status da_set_size(DynArray* da, size_t new_size) bool ok = true; // expanding if(size_delta_pa > 0) + { ok = vm::Commit(uintptr_t(end), size_delta_pa); + if(!ok) + debug_printf(L"Commit failed (%p %d)\n", end, size_delta_pa); + } // shrinking else if(size_delta_pa < 0) ok = vm::Decommit(uintptr_t(end+size_delta_pa), -size_delta_pa); diff --git a/source/lib/allocators/pool.h b/source/lib/allocators/pool.h index fb7f937045..a4a83ea4ec 100644 --- a/source/lib/allocators/pool.h +++ b/source/lib/allocators/pool.h @@ -247,7 +247,10 @@ public: { T* t = (T*)pool_alloc(&m_pool, count*sizeof(T)); if(!t) + { + debug_break(); throw std::bad_alloc(); + } return t; } diff --git a/source/lib/sysdep/os/win/wvm.cpp b/source/lib/sysdep/os/win/wvm.cpp index a6de15900b..3252fa79d3 100644 --- a/source/lib/sysdep/os/win/wvm.cpp +++ b/source/lib/sysdep/os/win/wvm.cpp @@ -238,6 +238,13 @@ static void* AllocateLargeOrSmallPages(uintptr_t address, size_t size, DWORD all statistics[processor].NotifySmallPageCommit(); return smallPages; } + else + { + MEMORY_BASIC_INFORMATION mbi = {0}; + SIZE_T ret = VirtualQuery(LPCVOID(address), &mbi, sizeof(mbi)); + debug_printf(L"Allocation failed. VirtualQuery returned %d\n", ret); + debug_printf(L"base=%p allocBase=%p allocProt=%d size=%d state=%d prot=%d type=%d\n", mbi.BaseAddress, mbi.AllocationBase, mbi.AllocationProtect, mbi.RegionSize, mbi.State, mbi.Protect, mbi.Type); + } return 0; }