nimare.utils
.use_memmap
- use_memmap(logger, n_files=1)[source]
Memory-map array to a file, and perform cleanup after.
New in version 0.0.8.
- Parameters
logger (
logging.Logger
) – A Logger with which to log information about the function.n_files (
int
, optional) – Number of memory-mapped files to create and manage.
Notes
This function is used as a decorator to methods in which memory-mapped arrays may be used. It will only be triggered if the class to which the method belongs has a
memory_limit
attribute that is set to something other thanNone
.It will set an attribute within the method’s class named
memmap_filenames
, which is a list of filename strings, withn_files
elements. Ifmemory_limit
is None, then it will be a list ofNones
.Files generated by this function will be stored in the NiMARE data directory and will be removed after the wrapped method finishes.