Bitcoin
|
#include <lockedpool.h>
Static Public Member Functions | |
static LockedPoolManager & | Instance () |
Private Member Functions | |
LockedPoolManager (std::unique_ptr< LockedPageAllocator > allocator) | |
Static Private Member Functions | |
static void | CreateInstance () |
static bool | LockingFailed () |
Static Private Attributes | |
static LockedPoolManager * | _instance = nullptr |
static std::once_flag | init_flag |
Additional Inherited Members | |
![]() | |
typedef bool(* | LockingFailed_Callback) () |
![]() | |
LockedPool (std::unique_ptr< LockedPageAllocator > allocator, LockingFailed_Callback lf_cb_in=nullptr) | |
~LockedPool () | |
LockedPool (const LockedPool &other)=delete | |
LockedPool & | operator= (const LockedPool &)=delete |
void * | alloc (size_t size) |
void | free (void *ptr) |
Stats | stats () const |
![]() | |
static const size_t | ARENA_SIZE = 256*1024 |
static const size_t | ARENA_ALIGN = 16 |
Singleton class to keep track of locked (ie, non-swappable) memory, for use in std::allocator templates.
Some implementations of the STL allocate memory in some constructors (i.e., see MSVC's vector<T> implementation where it allocates 1 byte of memory in the allocator.) Due to the unpredictable order of static initializers, we have to make sure the LockedPoolManager instance exists before any other STL-based objects that use secure_allocator are created. So instead of having LockedPoolManager also be static-initialized, it is created on demand.
|
explicitprivate |
|
staticprivate |
Create a new LockedPoolManager specialized to the OS
|
inlinestatic |
Return the current instance, or create it once
|
staticprivate |
Called when locking fails, warn the user here
|
staticprivate |
|
staticprivate |