Chose not to use NSCAssert() in alloc_darwin.m.
This commit is contained in:
parent
81ae03ffe2
commit
512819def7
|
@ -7,7 +7,10 @@ void *uiAlloc(size_t size, const char *type)
|
||||||
void *out;
|
void *out;
|
||||||
|
|
||||||
out = malloc(size);
|
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);
|
memset(out, 0, size);
|
||||||
if (options.debugLogAllocations)
|
if (options.debugLogAllocations)
|
||||||
fprintf(stderr, "%p alloc %s\n", out, type);
|
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)
|
if (p == NULL)
|
||||||
return uiAlloc(size, type);
|
return uiAlloc(size, type);
|
||||||
out = realloc(p, size);
|
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
|
// TODO zero the extra memory
|
||||||
if (options.debugLogAllocations)
|
if (options.debugLogAllocations)
|
||||||
fprintf(stderr, "%p realloc %p\n", p, out);
|
fprintf(stderr, "%p realloc %p\n", p, out);
|
||||||
|
|
Loading…
Reference in New Issue