From 1d7b08b85ba091a2b3a916e94a09cbba06d4c731 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Tue, 5 Aug 2014 12:05:27 -0700 Subject: [PATCH] dlmalloc does not fail when it runs out of memory... --- src/xenia/cpu/xenon_memory.cc | 1 + src/xenia/cpu/xenon_thread_state.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/src/xenia/cpu/xenon_memory.cc b/src/xenia/cpu/xenon_memory.cc index dd277efac..37bac9c61 100644 --- a/src/xenia/cpu/xenon_memory.cc +++ b/src/xenia/cpu/xenon_memory.cc @@ -508,6 +508,7 @@ uint64_t XenonMemoryHeap::Alloc( space_, alignment, alloc_size + heap_guard_size * 2); + assert_true(reinterpret_cast(p) <= 0xFFFFFFFFFull); if (FLAGS_heap_guard_pages) { size_t real_size = mspace_usable_size(p); DWORD old_protect; diff --git a/src/xenia/cpu/xenon_thread_state.cc b/src/xenia/cpu/xenon_thread_state.cc index 9b09c5608..a3403f0d2 100644 --- a/src/xenia/cpu/xenon_thread_state.cc +++ b/src/xenia/cpu/xenon_thread_state.cc @@ -24,6 +24,7 @@ XenonThreadState::XenonThreadState(XenonRuntime* runtime, uint32_t thread_id, stack_size_(stack_size), thread_state_address_(thread_state_address) { stack_address_ = memory_->HeapAlloc(0, stack_size, MEMORY_FLAG_ZERO); + assert_not_zero(stack_address_); // Allocate with 64b alignment. context_ = (PPCContext*)xe_malloc_aligned(sizeof(PPCContext));