-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
EventGenerator.function is a hard ref #3332
Copy link
Copy link
Closed
Labels
bugRelease notes labelRelease notes label
Description
EventGenerator.function is a hard reference rather than a weak ref as used in Event. This can lead to memory leaks if a generator is used in combination with, e.g., an Agent. If the agent is removed from the model but remains part of an EventGenerator, it cannot be garbage-collected.
The best solution is to turn function into a weakref, identical to how this is done in Event. However, this leaves a Model instance in an unpickleable state because the step method is currently scheduled via an EventGenerator.
There is also a link to #3319
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugRelease notes labelRelease notes label