- publishing free software manuals
GNU Scientific Library Reference Manual - Third Edition (v1.12)
by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, P. Alken, M. Booth, F. Rossi
Paperback (6"x9"), 592 pages, 60 figures
ISBN 0954612078
RRP £24.95 ($39.95)

Get a printed copy>>>

8.2.1 Block allocation

The functions for allocating memory to a block follow the style of malloc and free. In addition they also perform their own error checking. If there is insufficient memory available to allocate a block then the functions call the GSL error handler (with an error number of GSL_ENOMEM) in addition to returning a null pointer. Thus if you use the library error handler to abort your program then it isn't necessary to check every alloc.

Function: gsl_block * gsl_block_alloc (size_t n)
This function allocates memory for a block of n double-precision elements, returning a pointer to the block struct. The block is not initialized and so the values of its elements are undefined. Use the function gsl_block_calloc if you want to ensure that all the elements are initialized to zero.

A null pointer is returned if insufficient memory is available to create the block.

Function: gsl_block * gsl_block_calloc (size_t n)
This function allocates memory for a block and initializes all the elements of the block to zero.
Function: void gsl_block_free (gsl_block * b)
This function frees the memory used by a block b previously allocated with gsl_block_alloc or gsl_block_calloc. The block b must be a valid block object (a null pointer is not allowed).
ISBN 0954612078GNU Scientific Library Reference Manual - Third Edition (v1.12)See the print edition