ionelmc / python-hunter

Hunter is a flexible code tracing toolkit.
https://python-hunter.readthedocs.io/
BSD 2-Clause "Simplified" License
796 stars 46 forks source link

Removing previous tracers #59

Open robinsonkwame opened 5 years ago

robinsonkwame commented 5 years ago

Excellent library, I just started using hunter and have really enjoyed using it.

While playing around with hunter and trace I find that I have a lot of previous references to tracers that I no longer need.

hunter.stop() will set _last_tracer to None but if I make another call to hunter.trace(...) the previous tracers are shown to still reside in memory.

What's the best way to clear out unneeded tracers in hunter?

ionelmc commented 5 years ago

This sounds like a bug? Do you have an example of how you see the prev tracer still lingering around?

Either way the prev tracer area is going to get some rework to make coverage work smoothly so it would be great to get your example tested.

ionelmc commented 5 years ago

@robinsonkwame any update?

robinsonkwame commented 5 years ago

Sorry, I just haven't had time to pursue this. I think I discovered that while previous tracers were listed in memory they weren't firing if they were shutdown, but I'd have to attempt to recreate the problem again.

On Wed, May 29, 2019 at 9:50 AM Ionel Cristian Mărieș < notifications@github.com> wrote:

@robinsonkwame https://github.com/robinsonkwame any update?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ionelmc/python-hunter/issues/59?email_source=notifications&email_token=AB5ESR4Y32E2TYOAYFNPJRDPX2C3VA5CNFSM4HCZP4DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWPMQRQ#issuecomment-496945222, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5ESRYZZDAYDHITZJ6TZLLPX2C3VANCNFSM4HCZP4DA .

ionelmc commented 5 years ago

@robinsonkwame what do you mean by "they were shutdown"?

ionelmc commented 5 years ago

@robinsonkwame also note that hunter does not warn you about using it like this:

hunter.trace()
hunter.trace()

or:

with hunter.trace():
    with hunter.trace():
        ...

Maybe we could have some sort of warning but how I'd know if the user didn't actually intend to have multiple tracing scopes?