diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-10 13:06:29 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-10 13:06:29 -0400 |
| commit | 5bbaaeefe8b0ced1a2a16c50a2ebc3e4da9c432b (patch) | |
| tree | c9bb3d4c8b4650cfb268aab3094c0c0407ca832e | |
| parent | 1d29a65a19764490e3414525ad9fb88e5dc5c72e (diff) | |
Chose not to use NSCAssert() in alloc_darwin.m.
| -rw-r--r-- | new/alloc_darwin.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/new/alloc_darwin.m b/new/alloc_darwin.m index 1fa7195..c347e7a 100644 --- a/new/alloc_darwin.m +++ b/new/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); |
