Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Static Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
LockedPageManager Class Reference

Singleton class to keep track of locked (ie, non-swappable) memory pages, for use in std::allocator templates. More...

#include <allocators.h>

+ Inheritance diagram for LockedPageManager:
+ Collaboration diagram for LockedPageManager:

Static Public Member Functions

static LockedPageManagerInstance ()
 

Private Member Functions

 LockedPageManager ()
 

Static Private Member Functions

static void CreateInstance ()
 

Static Private Attributes

static LockedPageManager_instance = NULL
 
static boost::once_flag init_flag = BOOST_ONCE_INIT
 

Additional Inherited Members

- Public Member Functions inherited from LockedPageManagerBase< MemoryPageLocker >
 LockedPageManagerBase (size_t page_size)
 
 ~LockedPageManagerBase ()
 
void LockRange (void *p, size_t size)
 
void UnlockRange (void *p, size_t size)
 
int GetLockedPageCount ()
 

Detailed Description

Singleton class to keep track of locked (ie, non-swappable) memory pages, 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 LockedPageManager instance exists before any other STL-based objects that use secure_allocator are created. So instead of having LockedPageManager also be static-intialized, it is created on demand.

Definition at line 136 of file allocators.h.

Constructor & Destructor Documentation

LockedPageManager::LockedPageManager ( )
private

Definition at line 64 of file allocators.cpp.

Member Function Documentation

static void LockedPageManager::CreateInstance ( )
inlinestaticprivate

Definition at line 148 of file allocators.h.

References _instance.

Referenced by Instance().

+ Here is the caller graph for this function:

static LockedPageManager& LockedPageManager::Instance ( )
inlinestatic

Definition at line 139 of file allocators.h.

References _instance, CreateInstance(), and init_flag.

Referenced by secure_allocator< T >::allocate(), CCrypter::CCrypter(), secure_allocator< T >::deallocate(), LockObject(), UnlockObject(), and CCrypter::~CCrypter().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

LockedPageManager * LockedPageManager::_instance = NULL
staticprivate

Definition at line 159 of file allocators.h.

Referenced by CreateInstance(), and Instance().

boost::once_flag LockedPageManager::init_flag = BOOST_ONCE_INIT
staticprivate

Definition at line 160 of file allocators.h.

Referenced by Instance().


The documentation for this class was generated from the following files: