Is there a correct syntax for removing modules from the system memory?
If not I have a few modules in my game. When my gameplay module ends it goes to a gameEnd module, which provides an option to return to the gameplay module.
In between I get a memory leak.
At the start of the first gameplay module I get
System Memory : 137.0751953125
After ending and returning
System Memory : 148.6796875
I’m under the impression that I have removed all objects and listeners in each module as it moves from one to the next, so I don’t understand why this would happen if everything is removed correctly.
I would post the code but over 1400 lines so prob indecipherable as far as this is concerned. [import]uid: 10903 topic_id: 4887 reply_id: 304887[/import]
And since the package is a table (like basically all Lua things), you might be able to clear it from memory using this:
package.loaded[name] = nil
Director class uses a similar line to (presumably) remove scenes from memory after they’re used, so they can be properly garbage collected. [import]uid: 9747 topic_id: 4887 reply_id: 15768[/import]
Tried this and it made things worse, but was worth exploring. It may be that the memory use isn’t as big of an issue as I thought it might be, but it still bothers me that it leaks a little.
Is there any documentation of about what system memory is normal for even simple apps? [import]uid: 10903 topic_id: 4887 reply_id: 16365[/import]