RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.35k stars 1.27k forks source link

[pydrake] Factor out actual_ref_count() for tests #22126

Closed rpoyner-tri closed 2 weeks ago

rpoyner-tri commented 2 weeks ago

Move a quirky, but useful piece of memory test code to infrastructure, so it can be more easily reused.

This is progress toward fine-tuning pydrake object lifetimes, so they neither leak, nor get finalized too early.


This change is Reviewable

rpoyner-tri commented 2 weeks ago

bindings/pydrake/test/memory_leak_test.py line 100 at r1 (raw file):

Previously, SeanCurtis-TRI (Sean Curtis) wrote…
I guess I was surprised to see print statements in a test (instead of assertions). But, I note, this isn't the only print statement. So, I'll just accept my confusion.

That test optionally does a lot of printing (memory tuning is confusing?!?), all controlled by the VERBOSE=False at the top of the file.