AllocationRecorder

Qualified name: algan.utils.memory\_utils.AllocationRecorder

class AllocationRecorder[source]

Bases: object

Captures every ManualMemory allocation into a scope tree.

get_tensor is the arena’s single allocation entry point, so recording there covers every current and future buffer with no per-site annotation. That is what lets the memory tables be regenerated by measurement rather than maintained by hand.

Methods

clear

Drop scopes left open by an aborted render.

note_alloc

note_temp

pop_scope

push_scope

scopes

Every recorded scope with name, outermost first.

Attributes

current

clear()[source]

Drop scopes left open by an aborted render.

ManualMemory.reset runs while an OOM is still unwinding, so any open scope holds a truncated event stream that stops at the failing allocation. Detaching those keeps a partial measurement from being mistaken for a complete one – which would bias a calibrated coefficient downwards, the one direction that causes OOMs. They stay on abandoned for diagnostics.

scopes(name)[source]

Every recorded scope with name, outermost first.