Skip to content

Old PQS coroutines are never stopped, causing perf degradation over time #85

@gotmachine

Description

@gotmachine

Quoting @Gameslinx :

I found a fairly big problem yesterday relating to the PQS.UpdateSphere() coroutine starting without stopping the old one.
There should be at maximum two instances of the coroutine running at once. One for the ocean, and one for the terrain
However, whenever the PQS is restarted or set active, the coroutine is started again but if there was one running before this, it isn't stopped
So as an example, going from the Space Center to Kerbin will spawn an additional 2, making 4 of them running at once
Quicksaving and quickloading on the runway spawns 2 more each time, so I managed to rack up 14 of them running at once
image

Likely cause :

PQS.ResetSphere() is calling StopCoroutine("UpdateSphere").
This is the overload that takes a string arg for a named coroutine, but that only work if the coroutine was started using the matching string overload, which isn't the case, the coroutine is started in PQS.StartSphere() with the IEnumerator arg overload : StartCoroutine(UpdateSphere())

Metadata

Metadata

Assignees

No one assigned

    Labels

    kspBugIdentified KSP issuekspPerformancePossible performance improvement in KSP

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions