MA_SIZEOF_OVERHEAD(3)

NAME
MA_sizeof_overhead - compute size of block overhead

C SYNOPSIS
#include "macdecls.h"
Integer MA_sizeof_overhead(datatype)
    Integer     datatype;       /* read-only */

FORTRAN SYNOPSIS
#include "mafdecls.fh"
integer function MA_sizeof_overhead(datatype)
    integer     datatype

DESCRIPTION
MA_sizeof_overhead() returns the number of elements of type datatype required to contain the worst case number of bytes of overhead for any block.

USAGE
The following FORTRAN code illustrates the use of MA_sizeof_overhead() by computing the space required for 100 integers in 5 allocations in the heap, 200 logicals in 4 allocations in the heap, 300 reals in 3 allocations in the stack, and 400 doubles in 2 allocations in the stack.
#include "mafdecls.fh"
    logical ok
    integer heap_bytes_data
    integer heap_bytes_overhead
    integer heap_bytes_total
    integer stack_bytes_data
    integer stack_bytes_overhead
    integer stack_bytes_total
    heap_bytes_data = MA_sizeof(MT_INT, 100, MT_BYTE)
                    + MA_sizeof(MT_LOG, 200, MT_BYTE)
    heap_bytes_overhead = (5 + 4) * MA_sizeof_overhead(MT_BYTE)
    heap_bytes_total = heap_bytes_data + heap_bytes_overhead
    stack_bytes_data = MA_sizeof(MT_REAL, 300, MT_BYTE)
                     + MA_sizeof(MT_DBL, 400, MT_BYTE)
    stack_bytes_overhead = (3 + 2) * MA_sizeof_overhead(MT_BYTE)
    stack_bytes_total = stack_bytes_data + stack_bytes_overhead
    ok = MA_init(MT_BYTE, stack_bytes_total, heap_bytes_total)

DIAGNOSTICS
unable to set sizes of FORTRAN datatypes
This indicates either that the internal state of MA is corrupted or that there is a problem in the C-FORTRAN linkage.
invalid datatype: %d
datatype must be one of those listed in macdecls.h or mafdecls.fh.

RETURN VALUE
C: The number of elements, as described above.
FORTRAN: The number of elements, as described above.

FILES
Include files: /msrc/proj/hpctools/ma/release/current/include
Library:       /msrc/proj/hpctools/ma/release/current/lib/platform/libma.a
Man pages:     /msrc/proj/hpctools/ma/release/current/man/man3
Source code:   /msrc/proj/hpctools/ma/release/current/tar/marelease.tar

SEE ALSO
MA(3), MA_sizeof(3)

AUTHOR
Gregory S. Thomas, Pacific Northwest National Laboratory