Click or drag to resize

MemCAlloc Function

Allocate static memory buffers of a specified size.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.0
Syntax
 FUNCTION MemCAlloc(
	ui AS DWORD,
	cbCell AS DWORD
) AS IntPtr

Parameters

ui
Type: UInt32
The number of items to allocate memory for.
cbCell
Type: UInt32
The number of bytes to allocate for each item.

Return Value

Type: IntPtr
A pointer to the allocated space if there is sufficient memory available; otherwise, a IntPtr.Zero. You should always check the return value for a successful allocation.
Remarks
Tip Tip
The Static Memory Functions (MemAlloc, MemSet etc) are included for compatibility only. In most cases the static memory blocks can (and should) be replaced with arrays of bytes.
Many of the functions in the runtime that take memory blocks as parameter, such as the low level IO functions, now have overloads that take arrays of bytes as parameter.
We recommend that you use these overloads, because their performance is somewhat better.
See Also