Learn R Programming

freesurferformats (version 1.1.0)

next.buffer.capacity: Compute the next capacity for a growing result buffer.

Description

Validates that the data actually needed fits into the configured allocation limit, then returns the new buffer capacity to allocate. The capacity grows geometrically to keep the number of reallocations logarithmic, but it is capped at the limit: an overshoot of the growth must not make a read fail that would have fit into memory, and it must not exceed the limit either.

Usage

next.buffer.capacity(needed, capacity, bytes_per_elem = 8, label = NULL)

Value

numeric, the new capacity.

Arguments

needed

numeric, the number of rows that the buffer must hold.

capacity

numeric, the current capacity.

bytes_per_elem

numeric, bytes per row (for integer vectors this is the size of a single element).

label

character string or NULL, description used in error messages.