INtime SDK Help
malloc

Allocates a memory block of the specified size.

Note:   malloc allocates physical memory to the current process's Vseg as required. free() never physically releases memory allocated by malloc.
#include <stdlib.h>
void *malloc (size_t size);

void *_malloc_internal (size_t size);

Parameters

size
Bytes to allocate.

Remarks

The allocated block may be larger than the specified size, including space required for alignment and maintenance information. The memory is suitably aligned for storage of any type of object.

Always examine the return from malloc, even if the amount of memory requested is small.

_malloc_internal behaves identically to malloc, use it to implement your own debug version of malloc.

Return Values

Success.
A pointer to the allocated space. To get a pointer to a type other than void, use a type cast on the return value. For a size of 0 bytes, malloc returns a NULL.
Failure.
Returns a NULL pointer.
Note: For a size of 0 bytes, the NULL returned by malloc is a non-standard implementation. A call to malloc may fail due to physical memory exhaustion (ENOMEM) or virtual memory exhaustion. Virtual memory exhaustion may be detected by calling GetLastRtError() immediately after the malloc() failure. If physical memory is exhausted, the value is E_MEM, is virtual memory is exhausted the value is E_VMEM.
   

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/stdlib.h stdlib.h clib.lib

See Also

calloc, free, realloc, About heap object management functions, C/C++ Runtime heap, Memory pools