Struct tracking_allocator::AllocationGuard [−][src]
pub struct AllocationGuard { /* fields omitted */ }
Expand description
Guard that updates the current thread to track allocations for the associated allocation group.
Drop behavior
This guard has a Drop
implementation that resets the active allocation group back to the
previous allocation group.
Moving across threads
AllocationGuard
is specifically marked as !Send
/!Sync
as the active allocation group is
tracked at a per-thread level. If you acquire an AllocationGuard
and need to resume
computation on another thread, such as across an await point or when simply sending objects to
another thread, you must first exit
the guard and move the resulting AllocationToken
.
Once on the new thread, you can then reacquire the guard.
Implementations
Unmarks this allocation group as the active allocation group on this thread, resetting the active allocation group to the previous value.