You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In certain cases, leaving tracking enabled before main exits can lead to reentrancy of the tracking infrastructure as cleanup routines as triggered. As a concrete example, if println! is used in the allocation tracker implementation, this causes a panic at program exit:
implicit cleanup routine for stdio runs at end of main
this routine takes a lock and mutably borrows some internal state from a RefCell
a deallocation happens, which drops us into allocation tracking
as we println! in the allocation tracker, this drops us back into the print infrastructure
the locks guarding stdout/stderr are reentrant, so we still able to take them
the code again tries to mutably borrow some internal state, but alas, it is already borrowed
gasp! le panic.
While printing directly in the allocation tracker implementation is not advised, this still represents a general issue where we likely shouldn't be tracking anything past actual program code, which using a drop guard should achieve: we can clear the tracker implementation right before any runtime boilerplate cleanup runs.
The text was updated successfully, but these errors were encountered:
In certain cases, leaving tracking enabled before
main
exits can lead to reentrancy of the tracking infrastructure as cleanup routines as triggered. As a concrete example, ifprintln!
is used in the allocation tracker implementation, this causes a panic at program exit:main
RefCell
println!
in the allocation tracker, this drops us back into the print infrastructureWhile printing directly in the allocation tracker implementation is not advised, this still represents a general issue where we likely shouldn't be tracking anything past actual program code, which using a drop guard should achieve: we can clear the tracker implementation right before any runtime boilerplate cleanup runs.
The text was updated successfully, but these errors were encountered: