cxMemBoundsSet - resize memory boundary information
#include <cx/DataOps.h>

void cxMemBoundsSet( void *p, size_t size )
Memory pointer to be "resized".
Size in bytes of the array.
cxMemBoundsSet can be used to insure more accurate memory bounds checking when a data vector changes size. For example, if a module wanted to "flatten" a 3D lattice into a 1D lattice, it could first duplicate the lattice, then set the number of dimensions to 1 and the first dimension to the product of the 3 dimensions. However, the new dimensions array was created with a length of 3 (times the size of an integer). The memory bounds checking code now cannot detect errant code that sets the second or third dimension of the flattened lattice. The module should call cxMemBoundsSet on the dimension vector with a size of 1 (times the size of an integer). cxMemBoundsSet does NOT reallocate the memory block, it only sets information stored before and after the block of memory. It should not be used to increase the size of an array, unless you are certain the the array was originally allocated at least that large. It is safest to simply use cxDataRealloc(3E) to enlarge an array. cxDataRealloc sets the new memory bounds correctly. cxMemBoundsSet should never be used on memory not allocated in an IRIS Explorer data type. cxDataCheck(3E), cxDataMemBoundsCheck(3E).
Last modified: Mon Nov 6 16:33:29 GMT 2000
[ Documentation Home ]
© The Numerical Algorithms Group Ltd, Oxford UK. 1996