diff options
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkMemory_malloc.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ports/SkMemory_malloc.cpp b/src/ports/SkMemory_malloc.cpp index 3a5608ef15..0b936c9f8c 100644 --- a/src/ports/SkMemory_malloc.cpp +++ b/src/ports/SkMemory_malloc.cpp @@ -9,10 +9,19 @@ #include <stdio.h> #include <stdlib.h> +#define SK_DEBUGFAILF(fmt, ...) \ + SkASSERT((SkDebugf(fmt"\n", __VA_ARGS__), false)) + +static inline void sk_out_of_memory(size_t size) { + SK_DEBUGFAILF("sk_out_of_memory (asked for " SK_SIZE_T_SPECIFIER " bytes)", + size); + abort(); +} + static inline void* throw_on_failure(size_t size, void* p) { if (size > 0 && p == NULL) { // If we've got a NULL here, the only reason we should have failed is running out of RAM. - sk_out_of_memory(); + sk_out_of_memory(size); } return p; } |