next up previous 264
Next: astMemCaching - Controls whether allocated but unused memory is cached in this module
Up: AST Memory Management and Utility Functions
Previous: astIsDynamic - Returns a flag indicating if memory was allocated dynamically


astMalloc - Allocate memory

Description:
This function allocates memory in a similar manner to the standard C "malloc" function, but with improved security (against memory leaks, etc.) and with error reporting. It also allows zero-sized memory allocation (without error), resulting in a NULL returned pointer value.
Synopsis:
void $*$astMalloc( size_t size )
Parameters:
size
The size of the memory region required (may be zero).
Returned Value:
astMalloc()
If successful, the function returns a pointer to the start of the allocated memory region. If the size allocated is zero, this will be a NULL pointer.
Notes:
  • A pointer value of NULL is returned if this function is invoked with the global error status set or if it fails for any reason.


next up previous 264
Next: astMemCaching - Controls whether allocated but unused memory is cached in this module
Up: AST Memory Management and Utility Functions
Previous: astIsDynamic - Returns a flag indicating if memory was allocated dynamically

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 211
R.F. Warren-Smith & D.S. Berry
7th December 2012
E-mail:starlink@jiscmail.ac.uk

Copyright (C) 2012 Science \& Technology Facilities Council