mlx.core.metal.set_memory_limit#
- set_memory_limit(limit: int, *, relaxed: bool = True) int #
Set the memory limit.
Memory allocations will wait on scheduled tasks to complete if the limit is exceeded. If there are no more scheduled tasks an error will be raised if
relaxed
isFalse
. Otherwise memory will be allocated (including the potential for swap) ifrelaxed
isTrue
.The memory limit defaults to 1.5 times the maximum recommended working set size reported by the device.