cf.Data.fits_in_memory¶
-
Data.
fits_in_memory
()[source]¶ Return True if the array is small enough to be retained in memory.
Returns True if the size of the computed array, always including space for a full boolean mask, is small enough to be retained in available memory.
Performance
The delayed operations are actually not computed by
fits_in_memory
, so it is possible that an intermediate operation may require more than the available memory, even if the final array does not.See also
- Parameters
- itemsize: deprecated at version 3.14.0
The number of bytes per word of the master data array.
- Returns
bool
Whether or not the computed array fits in memory.
Examples
>>> d = cf.Data([1], 'm') >>> d.fits_in_memory() True
Create a double precision (8 bytes per word) array that is approximately twice the size of the available memory:
>>> size = int(2 * cf.free_memory() / 8) >>> d = cf.Data.empty((size,), dtype=float) >>> d.fits_in_memory() False >>> d.nbytes * (1 + 1/8) > cf.free_memory() True