Mono Class Library: Mono.Unix.Native.Stdlib Overview | Members

Mono.Unix.Native.Stdlib.calloc Method

Allocate and zero-fill memory. [Edit]

[System.CLSCompliant(false)]
public static IntPtr calloc (ulong nmemb, ulong size)

Parameters

nmemb
Number of objects to allocate. [Edit]
size
Size of each object to allocate. [Edit]

Returns

The calloc function returns a pointer to the allocated memory if successful; otherwise IntPtr.Zero is returned and Stdlib.GetLastError returns Errno.ENOMEM. [Edit]

Remarks

The calloc() function allocates space for nmemb objects, each size bytes in length. The result is identical to calling Stdlib.malloc(3) with an argument of "nmemb * size," with the exception that the allocated memory is explicitly initialized to zero bytes.

The return value of calloc must be passed to Stdlib.free to avoid a memory leak.

[Edit]

Requirements

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