Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Hot reload memory leak #30

Open
geekrelief opened this issue Jul 8, 2021 · 3 comments
Open

Hot reload memory leak #30

geekrelief opened this issue Jul 8, 2021 · 3 comments

Comments

@geekrelief
Copy link
Owner

There's a small memory leak that occurs on hot reload. When reloading bullet.nim, memory increases by about 0.2MB when looking at the TaskManager on Windows. I don't know if this is happening inside Godot(GDNative initializing) or gdnim (Watcher). There doesn't seem to be any memory leak without hot reloading.

@geekrelief
Copy link
Owner Author

Looking at module/gdnative/nativescript/godot_nativescript.cpp, when something is registered it gets inserted into a Map. The insert method checks if the key already exists, and if so replaces the value. So reregistering on hot reload should have no leakage on the Godot side unless a class reloads with fewer properties, methods or signals.

This suggests there's a leak in gdnim. Probably with Watcher which might be related to #29 and general crashing in ARC/ORC.

@geekrelief
Copy link
Owner Author

The fix for ORC stability on reload didn't fix the memory leak. The size of the leak is dependent on how many nodes are reloaded.

@geekrelief
Copy link
Owner Author

geekrelief commented Jul 9, 2021

The leak doesn't look like it's coming from Watcher based on what dumpInfo is showing. I can't rule out it's on gdnim's side.

At the minimum, the reload causes a 0.2MB leak, if I just change a float value and reload without instantiating anything new. In general usage this doesn't seem like a big deal, but it's something to be aware of.

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

No branches or pull requests

1 participant