Resizes a memory block.
Unit
EMemLeaks
Syntax
Code (Delphi)
|
function EurekaReallocMem(
P: Pointer;
Size: PtrInt
): Pointer;
|
Parameters
P [in]
A pointer to memory block returned by EurekaGetMem, EurekaTryGetMem or EurekaAllocMem.
Size [in]
New size of P in bytes. Size can be larger or smaller than original size of P. If Size is larger than old size, then the memory block will be expanded (with non initialized memory). If Size is smaller than old size, then the memory block will be truncated.
Return value
A pointer to allocated memory block of Size bytes. This value may or may not be equal to P. Old content of P is preserved. If Size is larger than old size of P, then newly added memory is not zero-initialized.
Remarks
EurekaReallocMem reallocates a memory block. EurekaGetMem allocates a block of the given Size on the heap. If you have to change the size of this memory block, call EurekaReallocMem, passing the existing memory block pointer in P and the revised block size in Size. If EurekaReallocMem can't expand the memory block pointed to by P, it frees the referenced memory and copies the values to the newly allocated memory that is returned. The content of the newly allocated memory is not set to zero.
Note
|
Do not call EurekaReallocMem manually. This function will be called automatically when you call ReallocMem function when EurekaLog's memory filter is installed.
|
Important!
|
EurekaReallocMem usually never returns nil nor raise exceptions. Memory allocation errors are considered to be fatal. EurekaLog will call MemLeaksError event handler to hanle memory allocation error and terminate the application. See also: MemLeaksErrorsToIgnore global variable. You can use an explicit call to EurekaTryGetMem function to allocate memory with ignoring errors.
|
See also
• | MemLeaksError Event Handler |
• | MemLeaksErrorsToIgnore Global Variable |
Send feedback...
|
Build date: 2024-09-30
Last edited: 2024-09-30
|
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation.
We do not use your e-mail address for any other purpose.
We will remove your e-mail address from our system after the issue you are reporting has been resolved.
While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback.
After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.
Permanent link to this article: https://www.eurekalog.com/help/eurekalog/topic_function_ememleaks_eurekareallocmem.php
|
|