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

Canvases don't get released while creating a new map instance. #235

Open
JuanjoSalvador opened this issue Apr 23, 2020 · 5 comments
Open
Labels

Comments

@JuanjoSalvador
Copy link
Contributor

I noticed that everytime we instance a new map, overwriting the old one, the Canvas objects are not released, maybe a LuaJIT related issue, so they are stuck there in memory.

Best solution for this would be adding a :canvasRelease() function, maybe, so we can force the release of the old stucked objects and free memory.

@shakesoda
Copy link
Collaborator

it will get gc'd anyways after a while if it isn't referenced anymore, is something preventing this from happening?

it would be good to be able to force it to release immediately, however

@JuanjoSalvador
Copy link
Contributor Author

As far I tested, it seems like the garbage collector isn't collecting this. I added a debug string into my game, showing how many canvases are created, and the number increments but no decrease.

I added a function to manually destroy the non-referenced canvases and it seems working fine, also the texture memory is not increasing on every new map instance, so... But we need a bug confirmation before.

@JuanjoSalvador
Copy link
Contributor Author

Update about this. I also reported this at Love2D forum, and I think we found a solution, no need to create a Canvas:release() function, just calling collectgarbage() on create new map instace, should work.

After testing this, there is no increase of memory.

@karai17
Copy link
Owner

karai17 commented Apr 24, 2020 via email

@JuanjoSalvador
Copy link
Contributor Author

Maybe keeping this as workaround at this moment is the best choice.

@karai17 karai17 added the info label Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants