Option setter for bounds checking. More...
Option setter for bounds checking.
This option defines a strategy to check upper memory boundary of allocated blocks.
Type defines a class for bound checking with following interface:
Before allocating a memory block of size N, the heap adds the
trailer_size to N and really it allocates N + trailer_size bytes. Then, the heap calls
make_trailer function of bound checker with arguments:
pStartArea- start of allocated block
pEndBlock- the first byte after really allocated block;
nAllocSize- requested size in bytes (i.e. N) So,
make_trailerfunction can place some predefined value called bound mark of any type, for example, int64, on address pStartArea + nAllocSize, and store real allocated block size N to pEndBlock - sizeof(size_t). In this example,
trailer_sizeconstant is equal sizeof(int64) + sizeof(size_t).
Before the memory block previously allocated is deallocating, the
check_bounds function is called. The function has similar signature:
pStartArea- start of allocated block (like
pEndBlock- the first byte after allocated block (like
nBlockSize- real allocated block size, not equal to
The function can:
The library provides the following predefined bound checkers, i.e they are possible values of
Type template argument: