Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential memory leaks identified by KSPCommunityFixes #3387

Closed
StonesmileGit opened this issue Jul 1, 2022 · 1 comment · Fixed by #3432
Closed

Potential memory leaks identified by KSPCommunityFixes #3387

StonesmileGit opened this issue Jul 1, 2022 · 1 comment · Fixed by #3432
Assignees

Comments

@StonesmileGit
Copy link

Latest version of KSPCommunityFixes reports on some potential memory leaks on scene changes. A quick look in the log shows 10 potential locations in Principia where a leak might exist.

[LOG 10:43:58.886] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a onGUIAstronautComplexSpawn GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.886] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a onGUIAstronautComplexDespawn GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.886] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a onGUIRnDComplexSpawn GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.886] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a onGUIRnDComplexDespawn GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.886] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a onGUIMissionControlSpawn GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.886] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a onGUIMissionControlDespawn GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.886] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a onGUIAdministrationFacilitySpawn GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.886] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a onGUIAdministrationFacilityDespawn GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.887] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a OnHideUI GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
[LOG 10:43:58.887] [KSPCF:MemoryLeaks] A destroyed principia.ksp_plugin_adapter:PrincipiaPluginAdapter instance is owning a OnShowUI GameEvents callback. No action has been taken, but unless this mod is relying on this pattern, this is likely a memory leak.
@pleroy
Copy link
Member

pleroy commented Jul 1, 2022

In OnAwake we add a bunch of GameEvents callbacks and of TimingManager callbacks.

In OnDisable we remove the TimingManager callbacks but we forget about the GameEvents callbacks.

I wonder if we could do the RAII thing to avoid this kind of glitch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants