Flutter Engine
The Flutter Engine
|
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkFeatures.h"
#include "include/private/base/SkMalloc.h"
#include <algorithm>
#include <cstdlib>
Go to the source code of this file.
Macros | |
#define | SK_DEBUGFAILF(fmt, ...) SkASSERT((SkDebugf(fmt"\n", __VA_ARGS__), false)) |
Functions | |
static void | sk_out_of_memory (size_t size) |
static void * | throw_on_failure (size_t size, void *p) |
void | sk_abort_no_print () |
void | sk_out_of_memory (void) |
void * | sk_realloc_throw (void *addr, size_t size) |
void | sk_free (void *p) |
void * | sk_malloc_flags (size_t size, unsigned flags) |
size_t | sk_malloc_size (void *addr, size_t size) |
Definition at line 35 of file SkMemory_malloc.cpp.
void sk_abort_no_print | ( | void | ) |
Called internally if we hit an unrecoverable error. The platform implementation must not return, but should either throw an exception or otherwise exit.
Definition at line 56 of file SkMemory_malloc.cpp.
void sk_free | ( | void * | p | ) |
Free memory returned by sk_malloc(). It is safe to pass null.
Definition at line 83 of file SkMemory_malloc.cpp.
void * sk_malloc_flags | ( | size_t | size, |
unsigned | flags | ||
) |
Return a block of memory (at least 4-byte aligned) of at least the specified size. If the requested memory cannot be returned, either return nullptr or throw/exit, depending on the SK_MALLOC_THROW bit. If the allocation succeeds, the memory will be zero-initialized if the SK_MALLOC_ZERO_INITIALIZE bit was set.
To free the memory, call sk_free()
Definition at line 91 of file SkMemory_malloc.cpp.
size_t sk_malloc_size | ( | void * | addr, |
size_t | size | ||
) |
Return the size of the block of memory allocated in reality for a given pointer. The pointer passed must have been allocated using the sk_malloc_* or sk_realloc_* functions. The "size" parameter indicates the size originally requested when the memory block was allocated, and the value returned by this function must be bigger or equal to it.
Definition at line 119 of file SkMemory_malloc.cpp.
|
inlinestatic |
Definition at line 38 of file SkMemory_malloc.cpp.
void sk_out_of_memory | ( | void | ) |
Called internally if we run out of memory. The platform implementation must not return, but should either throw an exception or otherwise exit.
Definition at line 66 of file SkMemory_malloc.cpp.
void * sk_realloc_throw | ( | void * | buffer, |
size_t | size | ||
) |
Same as standard realloc(), but this one never returns null on failure. It will throw if it fails. If size is 0, it will call sk_free on buffer and return null. (This behavior is implementation- defined for normal realloc. We follow what glibc does.)
Definition at line 75 of file SkMemory_malloc.cpp.
|
inlinestatic |
Definition at line 48 of file SkMemory_malloc.cpp.