Root > Reference > All Functions > EurekaAllocMem

Function EurekaAllocMem

Previous pageReturn to chapter overviewNext page   

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

 

Unit

EMemLeaks

 

Syntax

 

Code (Delphi)

function EurekaAllocMem(

Size: TIntForRealloc

): Pointer;

 

Parameters

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.

 

Remarks

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.

Note

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

 

Note

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

 

 

Important!

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: 2018-11-26
Last edited: 2018-11-26
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_eurekaallocmem.php