Flutter Engine
The Flutter Engine
|
#include "include/private/base/SkMalloc.h"
#include "include/core/SkTypes.h"
#include "mozilla/mozalloc.h"
#include "mozilla/mozalloc_abort.h"
#include "mozilla/mozalloc_oom.h"
#include <algorithm>
Go to the source code of this file.
Functions | |
void | sk_abort_no_print () |
void | sk_out_of_memory (void) |
void | sk_free (void *p) |
void * | sk_realloc_throw (void *addr, size_t size) |
void * | sk_malloc_flags (size_t size, unsigned flags) |
size_t | sk_malloc_size (void *addr, size_t size) |
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 19 of file SkMemory_mozalloc.cpp.
void sk_free | ( | void * | p | ) |
Free memory returned by sk_malloc(). It is safe to pass null.
Definition at line 28 of file SkMemory_mozalloc.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 36 of file SkMemory_mozalloc.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 43 of file SkMemory_mozalloc.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 23 of file SkMemory_mozalloc.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 32 of file SkMemory_mozalloc.cpp.