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

Memory overflow issues #24

Closed
WerWolv opened this issue Sep 8, 2018 · 0 comments
Closed

Memory overflow issues #24

WerWolv opened this issue Sep 8, 2018 · 0 comments
Labels
bug Something isn't working critical Critical bug that needs fixing ASAP good first issue Good for newcomers help wanted Extra attention is needed

Comments

@WerWolv
Copy link
Owner

WerWolv commented Sep 8, 2018

There are three main issues in EdiZon right now, possibly all caused by the same problem: The available RAM's overflowing.

First of all, EdiZon crashes when returning back to the hbmenu using the + button. This will cause a 2168-0001 (Userland ARM prefetch-abort due to PC set to non-executable region)
This issue was caused by deleting the current GUI object in the input thread without the use of a mutex. Input thread deletes GUI -> main thread is executing code in freed memory -> prefetch abort

Sadly the switch is still crashing when exiting. This time though the crash causes a 2168-0002 (Segfault). Most likely caused by freeing an already deleted array somewhere in the destructor of a static object.
Additionally, the switch only crashes when pressing the PLUS button, if you're not editing a game. It crashes in the GuiMain and the GuiEditor when not editing.

The error was caused by calling lua_close in the destructor of ScriptParser. I had a global instance of ScriptParser in GuiEditor (which REALLY should be a member variable) which got deleted, when closing the program, therefore calling the destructor and lua_close with a nullptr as lua context. This, of course, caused a Segfault.

Second, loading lua modules inside scripts causes a 2168-0002 (Segfault) in some cases. Needs further investigation. For example, Octopath works but Hollow Knight doesn't.
This issue was introduced in commit $1ebb351 and is probably caused by EdiZon accessing the luaState from the input thread while it was initially created by the main thread.

The last issue is probably caught by Lua, therefore not causing a segfault. When loading huge save files as string into a Lua script, Lua will replace the entire string with not enough memory.
I think the issue lies somewhere in the EdiZon code being wasteful on resources or having serve memory leaks.

This last issue was actually a bug in Lua version 5.3.4 and should have been fixed by updating the Lua runtime to 5.3.5. Needs further testing/confirmation though

If anybody has time and wants to check the code for issues like this, you're very welcome to do so!

@WerWolv WerWolv added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers critical Critical bug that needs fixing ASAP labels Sep 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working critical Critical bug that needs fixing ASAP good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant