cxMemBoundsSet
- resize memory boundary information
C SPECIFICATION
#include <cx/DataOps.h>
void cxMemBoundsSet( void *p, size_t size )
PARAMETERS
p
Memory pointer to be "resized".
size
Size in bytes of the array.
DESCRIPTION
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).
NOTE
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.