FX::FXProcess_MemLock Class Reference

#include <FXProcess.h>

List of all members.


Detailed Description

Prevents a region from being paged out for the duration of its existence.

This little class for the duration of its existence locks a range of a process' address space into memory, thus preventing it from being paged out. This can be useful when utmost performance is required or more likely to prevent secure data from being leaked. The FX::Secure namespace heap manages one of these automatically.

What you specify to this class at construction and what actually gets locked can vary, not least because locking is done in units of FX::FXProcess::pageSize(). You can determine what pages are locked at any given time using FX::FXProcess::lockedPages(). Nested locks across multiple threads are fine eg;

FXProcess_LockMem h1(ptr, 16384);       // Thread 1
FXProcess_LockMem h2(ptr+4096, 32768);  // Thread 2
delete h1;                              // Thread 1
In the above, the region ptr+4096 to ptr+36864 remains locked.

Warning:
Many operating systems view locking too many pages in memory as a malicious act and so FXRESTRICT the maximum per process. In particular on Windows NT systems it can be a very low amount, perhaps only 200Kb.

Definition at line 554 of file FXProcess.h.

Public Member Functions

 FXProcess_MemLock ()
 FXProcess_MemLock (void *startaddr, FXuval length)
 FXProcess_MemLock (const FXProcess_MemLock &o)
FXProcess_MemLockoperator= (const FXProcess_MemLock &o)
 ~FXProcess_MemLock ()
void * location () const throw ()
FXuval length () const throw ()


The documentation for this class was generated from the following file:
(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:35:41 2009 for TnFOX by doxygen v1.4.7