Flutter Engine
The Flutter Engine
|
#include <SkAutoMalloc.h>
Public Member Functions | |
SkAutoSMalloc () | |
SkAutoSMalloc (size_t size) | |
~SkAutoSMalloc () | |
void * | get () const |
void * | reset (size_t size, SkAutoMalloc::OnShrink shrink=SkAutoMalloc::kAlloc_OnShrink, bool *didChangeAlloc=nullptr) |
Manage an allocated block of memory. If the requested size is <= kSizeRequested (or slightly more), then the allocation will come from the stack rather than the heap. This object is the sole manager of the lifetime of the block, so the caller must not call sk_free() or delete on the block.
Definition at line 90 of file SkAutoMalloc.h.
|
inline |
Creates initially empty storage. get() returns a ptr, but it is to a zero-byte allocation. Must call reset(size) to return an allocated block.
Definition at line 96 of file SkAutoMalloc.h.
|
inlineexplicit |
Allocate a block of the specified size. If size <= kSizeRequested (or slightly more), then the allocation will come from the stack, otherwise it will be dynamically allocated.
Definition at line 105 of file SkAutoMalloc.h.
|
inline |
Free the allocated block (if any). If the block was small enough to have been allocated on the stack, then this does nothing.
Definition at line 115 of file SkAutoMalloc.h.
|
inline |
Return the allocated block. May return non-null even if the block is of zero size. Since this may be on the stack or dynamically allocated, the caller must not call sk_free() on it, but must rely on SkAutoSMalloc to manage it.
Definition at line 126 of file SkAutoMalloc.h.
|
inline |
Return a new block of the requested size, freeing (as necessary) any previously allocated block. As with the constructor, if size <= kSizeRequested (or slightly more) then the return block may be allocated locally, rather than from the heap.
Definition at line 133 of file SkAutoMalloc.h.