From 512819def73d775960c12e3f29f7fa968ec421d5 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 10 Apr 2015 13:06:29 -0400 Subject: [PATCH] Chose not to use NSCAssert() in alloc_darwin.m. --- alloc_darwin.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/alloc_darwin.m b/alloc_darwin.m index 1fa7195f..c347e7a1 100644 --- a/alloc_darwin.m +++ b/alloc_darwin.m @@ -7,7 +7,10 @@ void *uiAlloc(size_t size, const char *type) void *out; out = malloc(size); - NSCAssert(out != NULL, @"out of memory in uiAlloc()"); + if (out != NULL) { + fprintf(stderr, "memory exhausted in uiAlloc() allocating %s\n", type); + abort(); + } memset(out, 0, size); if (options.debugLogAllocations) fprintf(stderr, "%p alloc %s\n", out, type); @@ -21,7 +24,10 @@ void *uiRealloc(void *p, size_t size, const char *type) if (p == NULL) return uiAlloc(size, type); out = realloc(p, size); - NSCAssert(out != NULL, @"out of memory in uiRealloc()"); + if (out != NULL) { + fprintf(stderr, "memory exhausted in uiRealloc() reallocating %s\n", type); + abort(); + } // TODO zero the extra memory if (options.debugLogAllocations) fprintf(stderr, "%p realloc %p\n", p, out);