Rust Drop Logging for Runtime Memory Management Debugging


Run-time memory management with Rc can be very useful, but it can also be difficult to wrap one's head around, especially if your code is very complex and a single instance is referenced by tens or even hundreds of other types in many scopes.

Writing a Drop trait that includes println!("Dropping StructName: {:?}", self); can be immensely valuable for debugging, as it allows you to see precisely when the strong references to a struct instance run out.