umalloc — Micro Allocator
The umalloc module provides access to the OpenMV Micro Allocator (UMA),
allowing scripts to initialize, collect, and inspect statistics for the
underlying memory pool.
Example:
import umalloc
umalloc.print_stats()
Functions
- umalloc.collect() None
Runs a collection cycle on the Micro Allocator, releasing memory that is no longer in use.
- umalloc.stats(index: int = -1) tuple[int, int, int, int, int, int, int]
Returns a 7-tuple of statistics for the allocator pool selected by
index. Whenindexis-1(the default), aggregated statistics across all pools are returned.The tuple contains:
used_count— number of currently allocated blocks.free_count— number of free blocks.persist_count— number of persistent blocks.used_bytes— total bytes currently allocated.free_bytes— total bytes free.persist_bytes— total bytes held by persistent allocations.peak_bytes— peak bytes ever allocated.