Root > Reference > All Functions > EurekaAllocMem

Function EurekaAllocMem

Previous pageReturn to chapter overviewNext page   

AllocMem allocates a memory block and initializes each byte to zero.







Code (Delphi)

function EurekaAllocMem(

Size: TIntForRealloc

): Pointer;



Size [in]

A size of memory block to allocate (in bytes).


Return value

A pointer to allocated memory block of Size bytes. Memory block is zero-initialized.



EurekaAllocMem allocates a block of the given Size on the heap, and returns the address of this memory. Each byte in the allocated buffer is set to zero. To dispose of the buffer, use EurekaFreeMem. If there is not enough memory available to allocate the block, an leOutOfMemory error is raised.


If the memory does not need to be zero-initialized, you can use EurekaGetMem.



Do not call EurekaAllocMem manually. This function will be called automatically when you call AllocMem function when EurekaLog's memory filter is installed.




EurekaAllocMem 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: 2023-05-05
Last edited: 2023-05-05
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: