template<class
T>
class OverrunProtector< T >
OverrunProtector wraps an arbitrary object in isolated page(s) and can detect inadvertent writes to it.
this is useful for tracking down memory overruns.
the basic idea is to require users to request access to the object and notify us when done; memory access permission is temporarily granted. (similar in principle to Software Transaction Memory).
since this is quite slow, the protection is disabled unless CONFIG2_ALLOCATORS_OVERRUN_PROTECTION == 1; this avoids having to remove the wrapper code in release builds and re-write when looking for overruns.
example usage: OverrunProtector<T> wrapper; .. T* p = wrapper.get(); // unlock, make ready for use if(!p) // wrapper's one-time alloc of a T- abort(); // instance had failed - can't continue. DoSomethingWith(p); // (read/write access) wrapper.lock(); // disallow further access until next .get() ..