js_alloc(3)

NAME
js_alloc - allocate memory from the underlying OS

SYNOPSIS
#include JsStr.h

void *js_alloc(int unit_count, int unit_size)

DESCRIPTION
js_alloc allocates memory from the underlying OS. It returns a pointer to the allocated memory.

ARGUMENTS
unit_count is the number of units that are allocated. A single unit takes up one or more octets of memory space. The amount of space a single unit takes up is determined by the unit_size argument.

unit_size determines the number of bytes a single unit takes up.

RETURN VALUE
js_alloc returns a pointer to the allocated memory. If it is unable to allocate memory, this function will return the value 0 (the null pointer, as defined by the C standard).

EXAMPLE
The following example allocates 256 octets of memory.

	char *foo;
	foo = js_alloc(256,1);

NOTES
This function assumes that an allocated chunk of memory will not move in memory. On certain embedded systems, such as the Palm Pilot, allocated memory may move around in memory.

AUTHOR
Sam Trenholme <kiwi-zttfryb@koala.samiam.org>