* Only compile OE PAL if required.

* OE:reserve: Fix bug in loop.

* Handle out of memory by returning nullptr.
This commit is contained in:
Matthew Parkinson
2020-03-25 08:10:39 +00:00
committed by GitHub
parent 0a081cacd6
commit 77c453600b
5 changed files with 36 additions and 14 deletions

View File

@@ -24,8 +24,7 @@ extern "C" const void* __oe_get_heap_end()
extern "C" void* oe_memset_s(void* p, size_t p_size, int c, size_t size)
{
std::cout << "Memset " << p << " (" << p_size << ") - " << size << std::endl;
UNUSED(p_size);
return memset(p, c, size);
}
@@ -50,10 +49,14 @@ int main()
auto a = ThreadAlloc::get();
for (size_t i = 0; i < 1000; i++)
while (true)
{
auto r1 = a->alloc(100);
std::cout << "Allocated object " << r1 << std::endl;
// Run until we exhaust the fixed region.
// This should return null.
if (r1 == nullptr)
return 0;
if (oe_base > r1)
abort();