JCL Help:SHReallocMem

From Project JEDI Wiki
Jump to navigationJump to search


Reallocates (changes the size) a block of memory in the shell's memory space. The contents of the block prior to reallocation are reserved but there is no guarantee that the pointer will retain its value. The newly allocated block may be on a different address if there is not enough room to expand it in place. Also the actual size of the allocated block maybe slightly larger then the requested size because of additional maintenance data (not accessible).


 function SHReallocMem(var P: Pointer; Count: Integer): Boolean;


Parameters Description
var P: Pointer On input pointer to a memory block previously allocated with either SHGetMem SHAllocMem or nil. In the latter case SHReallocMem functions just like SHGetMem.
Count: Integer Total size, in bytes, to (re)allocate. If 0 then the memory pointed to be P (if not nil) is freed.

Return Value

If the function succeeds it returns True and P contains the address of the reallocated memory block. If the function fails it returns False, and P will retain its value.


SHReallocMem reallocates a specified memory block to a new size using the shell's memory allocator. If on input P is not nil then it must point to a block of memory previously allocated with the shell's memory allocator (SHGetMem or SHAllocMem).

See Also

SHAllocMem SHGetMem SHFreeMem





Marcel van Brakel

Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page