Thrown when an allocation request cannot be satisfied by the device allocator.
The exception captures the failed request size together with the current
and peak usage counters tracked by MemoryTracker for the offending
device, so callers (or end-users reading the Python traceback) can
distinguish OOM caused by absolute size from OOM caused by fragmentation.
Mapped to lucid._C.engine.OutOfMemory on the Python side.
Parameters
requested_bytesstd::size_tcurrent_bytesstd::size_tpeak_bytesstd::size_tdevicestd::string"cpu", "metal:0").Attributes
requested_bytes_std::size_tcurrent_bytes_std::size_tpeak_bytes_std::size_tdevice_std::stringExamples
`
throw OutOfMemory(1ull << 30, current, peak, "metal:0");
`Constructors
1OutOfMemory
void OutOfMemory(int requested_bytes, int current_bytes, int peak_bytes, int device)Construct an OutOfMemory error from the failed allocation size, the tracker's current/peak usage at the moment of failure, and the offending device label. All four arguments are formatted into the human-readable what() message so end-users can distinguish absolute-size OOM from fragmentation-induced OOM.
Methods
4Returns the live byte count at the time of failure.
Returns
std::size_tBytes already in-use on the device when the allocator failed.
Returns the device label where the allocation was attempted.
Returns
const std::string&Reference to the stored device string. Lifetime is tied to *this.
Returns the peak byte count observed on the device.
Returns
std::size_tThe high-water mark recorded by the memory tracker.
Returns the number of bytes that the failed allocation requested.
Returns
std::size_tThe original requested_bytes argument.