Jump to content

SOMMalloc: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 10: Line 10:


==Parameters==
==Parameters==
; size (size_t): The amount of memory to be allocated, in bytes.  
; size (size_t): The amount of memory to be allocated, in bytes.


==Return Code==
==Return Code==
; rc (somToken) : A pointer to the first byte of the allocated space.  
; rc (somToken) : A pointer to the first byte of the allocated space.


==Remarks==
==Remarks==
This function allocates size bytes of memory. This function has the same interface as the C malloc function. It performs the same basic function as malloc with some supplemental error checking. If an error occurs, the SOMError function is called. This routine is replaceable by changing the value of the global variable SOMMalloc.  
This function allocates size bytes of memory. This function has the same interface as the C malloc function. It performs the same basic function as malloc with some supplemental error checking. If an error occurs, the SOMError function is called. This routine is replaceable by changing the value of the global variable SOMMalloc.


==Example Code==
==Example Code==
<PRE>
See function [[somFree]].
</PRE>


==Related==
==Related==
===Functions===
===Functions===
* [[SOMCalloc]]  
* [[SOMCalloc]]
* [[SOMRealloc]]
* [[SOMRealloc]]
* [[somFree]]  
* [[somFree]]


[[Category:SOM Kernel]]
[[Category:SOM Kernel]]

Latest revision as of 16:21, 12 October 2022

This function allocates the specified amount of memory.

Syntax

size_t      size;
somToken    rc;

rc = (*SOMMalloc)(size);

Parameters

size (size_t)
The amount of memory to be allocated, in bytes.

Return Code

rc (somToken)
A pointer to the first byte of the allocated space.

Remarks

This function allocates size bytes of memory. This function has the same interface as the C malloc function. It performs the same basic function as malloc with some supplemental error checking. If an error occurs, the SOMError function is called. This routine is replaceable by changing the value of the global variable SOMMalloc.

Example Code

See function somFree.

Related

Functions