Skip to content

Conversation

michaeldel
Copy link
Contributor

@michaeldel michaeldel commented Feb 24, 2020

Fixes #587. When using the SDL backend, cursors were created every frame but not being freed by SDL_FreeCursor (in fact they were not even tracked at all). This led the Xorg server cursor memory to fill up and never be freed, ending up requiring restarting X.

This issue did not happen when using the Sokol backend.

xrestop makes it easy to figure this leak out, while tic80 is running

$ xrestop -b -m 1 | grep -A 15 'TIC-80' | grep cursors | cut -d: -f 2 | xargs
824 # before fix, increased _a lot_ every frame, would end up in gigabytes of memory used

$ xrestop -b -m 1 | grep -A 15 'TIC-80' | grep cursors | cut -d: -f 2 | xargs
1 # after fix

@michaeldel michaeldel requested a review from nesbox February 24, 2020 22:06
Copy link
Owner

@nesbox nesbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally, you caught it
thank you :)

@nesbox nesbox merged commit f43bad9 into nesbox:master Feb 25, 2020
@nesbox nesbox added the bug label Feb 25, 2020
@nesbox nesbox added this to the 0.80.0 milestone Feb 25, 2020
nesbox added a commit that referenced this pull request Feb 29, 2020
@nesbox nesbox removed this from the 0.80.0 milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate memory leak on Linux
2 participants