mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 03:06:29 +00:00
add instrumentation to diagnose failed VM commit
This was SVN commit r10405.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user