Boolean LMemReAlloc(
optr chunk, /* optr of chunk to resize */
word chunkSize); /* New size of chunk in bytes */
This routine resizes a chunk in an LMem heap. The heap must be in a locked or fixed block. If the routine succeeds, it returns zero. If it fails (because the heap ran out of space and could not be expanded), it returns non-zero.
If the new size is larger than the original size, extra bytes will be added to the end of the chunk. These bytes will not be zero-initialized. The heap may have to be compacted or resized to accommodate the request; thus, all pointers to data within the block are invalidated.
If the new size is smaller than the old, the chunk will be truncated. The request is guaranteed to succeed, and the chunk will not be moved; neither will the heap be compacted or resized. Thus, all pointers to other chunks remain valid. Reallocating a chunk to zero bytes is the same as freeing it.
Be Sure To: Lock the block on the global heap (unless it is fixed).
Warnings: As noted, if the new size is larger than the old, the heap may be compacted or resized, invalidating pointers.
Include: lmem.h
See Also: LMemReAllocHandles(),
LMemInsertAt(),
LMemDeleteAt().
Boolean LMemReAllocHandles(
MemHandle mh, /* Handle of LMem heap */
ChunkHandle chunk, /* Handle of chunk to resize */
word chunkSize); /* New size of chunk in bytes */
This routine is just like
LMemReAlloc()
above, except that the chunk is specified by its global and chunk handles (instead of by an optr).
Be Sure To: Lock the block on the global heap (unless it is fixed).
Warnings: As noted, if the new size is larger than the old, the heap may be compacted or resized, invalidating pointers.
Include: lmem.h
GEOS SDK TechDocs
|
|
LMemGetChunkSize() ...
|
LocalAsciiToFixed() ...