Skip to content

EventGenerator.function is a hard ref #3332

@quaquel

Description

@quaquel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugRelease notes label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions