TempMemoryContext¶
Qualified name: algan.utils.memory\_utils.TempMemoryContext
- class TempMemoryContext(memory, clear_persist, persist_floor=None)[source]¶
Bases:
objectRestore the arena pointers on exit.
clear_persistadditionally rewinds the persistent (reverse) pointer to its value at entry.persist_flooris a zero-argument callable returning a reverse pointer that rewind must not cross, orNone– for the caller that allocates something batch-lived at the persistent end from inside the scope and needs it readable after the scope closes. It is read on exit, not on entry, because that allocation happens during the block. Explicit rather than inferred from the arena, so an unrelated persistent allocation inside the scope is still reclaimed.Methods