NhlMalloc

NhlMalloc, NhlRealloc, NhlFree

No corresponding Fortran routines.

Memory allocation functions.


Synopsis

#include <ncarg/hlu/hlu.h>

void *NhlMalloc(
		unsigned int	size
		)

void *NhlRealloc(
		void		*data,
		unsigned int	size
		)

NhlErrorTypes NhlFree(
		void		*data
		)

Arguments

size
Specifies the size of the memory to allocate.
data
Specifies a pointer to memory previously returned from NhlMalloc or NhlRealloc.

Description

These functions behave like the stdlib functions malloc, realloc and free.

NhlMalloc returns a pointer to a block of memory of at least size bytes. The argument to NhlFree is a pointer to a block previously allocated with NhlMalloc. If NhlMalloc is called with a size of 0, it returns NULL.

NhlFree frees the memory pointed at by data so the memory can be re-used. NhlFree must be called on all memory allocated by the HLU library on behalf of the user. This includes all arrays retrieved from objects using NhlGetValues. If NhlFree is called with a NULL pointer, it doesn't work.

NhlRealloc changes the size of the block of memory pointed at by data. It may extend the current block or allocate another block, copy the contents pointed at by data to the new location, and then free the old block. It returns a pointer to the new block. If data is NULL, NhlRealloc behaves like NhlMalloc.


Return values

NhlMalloc
returns a pointer to a block of memory, or NULL if a size 0 is specified or if it can't allocate the memory.
NhlRealloc
returns a pointer to a block of memory, or NULL if a size 0 is specified or if it can't allocate the memory.
NhlFree
returns NhlNOERROR if there is no error, or NhlWARNING if there is a detectable error.

Copyright

Copyright 1987,1988,1989,1991,1993,1994,1995
University Corporation for Atmospheric Research
All Rights Reserved

Reference Manual Control Panel

NG4 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?


$Revision: 1.8 $ $Date: 1995/07/26 23:28:06 $