Mono Class Library: Mono.Unix.UnixMarshal Overview | Members

Mono.Unix.UnixMarshal.AllocHeap Method

Allocates size bytes from the system heap. [Edit]

public static IntPtr AllocHeap (long size)

See Also

UnixMarshal.FreeHeap
Mono.Unix.Native.Stdlib.malloc

Parameters

size
A long containing the number of bytes to allocate on the system heap. [Edit]

Returns

A IntPtr containing the address of size bytes on the system heap, or IntPtr.Zero if the memory could not be allocated. [Edit]

Exceptions

TypeReason
ArgumentOutOfRangeExceptionsize is a negative value. [Edit]

Remarks

The "system heap" is where dynamic memory is allocated by the runtime C library, MSVCRT.DLL on Win32 and libc on Unix platforms.

The memory allocated by this function must be freed via UnixMarshal.FreeHeap to avoid a memory leak.

[Edit]

Requirements

Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0