nlib
|
Namespace for the heap
library. Functions such as nmalloc
and nfree
are defined in the global namespace.
More...
Classes | |
class | CachedHeap |
Thread-specific cache class whose use is paired with CentralHeap . More... | |
class | CentralHeap |
Central heap class whose use is paired with CachedHeap . It is used to implement nmalloc . More... | |
class | FrameHeap |
Allows memory to be allocated from both sides of the heap. More... | |
class | StackHeap |
Allocator that allocates memory from the top like a stack. More... | |
class | UnitHeap |
Heap for allocating and freeing fixed-size regions of memory. This is a so-called "pool-allocator.". More... | |
Namespace for the heap
library. Functions such as nmalloc
and nfree
are defined in the global namespace.
nmalloc
and nfree
both have the following characteristics. double free
detection, write detection after calling free
, and metadata overwrites in heap
. free
. nmalloc_aligned
enables allocation of aligned memory regions. nrealloc
is an implementation of realloc
that operates with reasonable efficiency. nmalloc_heaphash
to promptly get a hash of the overall heap status. nmalloc
by calling nmalloc_walk_allocated_ptrs
. It is possible to deal with leaked memory by forcibly freeing it, for example. NMALLOC_HEAPOPTION_CHECK_1
option makes it possible to add two 16-bit values to each memory region that was allocated using nmalloc
. nmalloc
and nfree
functions are implemented using nn::nlib::heap::CentralHeap
and nn::nlib::heap::CachedHeap
. There is one CentralHeap
object per process and one CachedHeap
object per thread, which correspond to nmalloc
and nfree
, and code within a process shares these objects. Alternatively, developers can create these objects and heaps directly on their own, and use these heaps to allocate and free memory.nn::nlib::heap::StackHeap
Heap that allocates memory from the top like a stack. nn::nlib::heap::FrameHeap
Heap that can be used to allocate memory from the top or bottom of a memory region. nn::nlib::heap::UnitHeap
Heap that allocates fixed-size regions of memory. CachedHeap
is used, this type of lock may not be necessary. In addition, when a program is first created, even if memory was intended to be used as single-thread-specific memory, the ownership of the allocated memory may have to be passed to another thread. Note that for this reason, using CentralHeap
and CachedHeap
may be more immediate and faster. heap/nmalloc_simple/nmalloc_simple.cpp
sample. © 2013, 2014, 2015 Nintendo Co., Ltd. All rights reserved.