cool-RR / PySnooper

Never use print for debugging again
MIT License
16.39k stars 954 forks source link

Delete frames when exiting to free up memory #111

Closed alexmojaki closed 5 years ago

alexmojaki commented 5 years ago

Tracer currently holds on to every frame it has traced, including all its local variables (not just their reprs). Try this script:

import pysnooper

@pysnooper.snoop()
def foo():
    lst = list(range(1000))

while 1:
    foo()

and check top. The memory usage skyrockets.

cool-RR commented 5 years ago

Good catch!