Skip to content

Memory Leak in DefaultLightFilter #1839

@Lukas-Habring

Description

@Lukas-Habring

If your code frequently adds new Light-objects to the scene and removes old ones, DefaultLightFilter will keep the old Light-objects alive by storing them in its internal HashSet.
The internal HashSet will never be cleared, therefore they are kept alive forever.
After a few hours of running a benchmark on my game, I realized that the HashSet has grown to ~18MiB size with ~190.000 entries.
Changing the camera (which may happen multiple times per frame) can get very expensive in this scenario.
I would suggest clearing the HashSet each frame.

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSomething that is supposed to work, but doesn't. Less severe than a "bug"

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions