ophyd
ophyd copied to clipboard
Clearing pyepics callbacks for an ophyd object
Back in December I remember looking for a way to delete the pyepics cache created by an ophyd object, once you are done with the ophyd object. It has been a while but I remember trying the destroy method, clear_callbacks, and release_pvs and none of them seemed to do what I wanted, which was clear the cache of a specific ophyd object while leaving the others in tact. So I wrote this function which seems to work:
https://github.com/bsobhani/bsstudio/blob/f05a34f583bf29488cbeb988ad7bdc5256216e96/bsstudio/functions.py#L232
Maybe the EpicsSignal class would benefit from having a method that clears the callbacks like this? Otherwise, you cannot create an ophyd object that is temporary, because this pyepics cache memory remains after the ophyd object goes out of scope, and I have seen it add up to large numbers over time.