OH NO! Its the EVIL Mario sprite OF DOOM!, long story short, rendering mario sprite on my raspberry pi causes mysterious freezing, then find out on windows that its a memory leak, a memory leak so severe that it jumped from around 70MB of ram usage to 4GB of ram, nearly choking all the free memory i have, reigning it's unholy wrath down on my poor innocent computer with the fury of a thousand gods. I dont know how to fix this and i have looked at similar cases with no luck . The .love is attached below (it is bundled with the memory leak so be careful and dont let it dissintegrate your ram)
Navigation around the project:
main.lua simply loads in the game, because its also possible to launch a crappy chunk editor by running it on the command line via "-editor"
game.lua the actual game file
Assets_Scripts/TilesetLoader.lua not the problem, but it is responsible for slicing tilesets (including mario sprite) into tiles
Assets_Scripts/AnimatedDrawables.lua still not the problem but also slices images up tileset-style, but for animation
Assets_Images/Mario.png the mario sprite being sliced
Mario.png gets sliced at game.lua:58
Mario gets rendered at game.lua:381
Severe memory leak upon rendering player
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 7
- Joined: Fri Dec 06, 2019 11:26 pm
Severe memory leak upon rendering player
- Attachments
-
- AAAAAAAA.love
- (20.41 MiB) Downloaded 184 times
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Severe memory leak upon rendering player
Hi and welcome to the forums.
Okay, i had a look, but the project's huge already...
While i didn't see any too obvious issues regarding creating tons of löve objects each update (which still might be the case though), i did notice your LoadTileset function creating both ImageDatas *and* Images for each tile you iterate over;
That in and of itself is both very RAM and VRAM heavy;
Consider not caring about ImageDatas at all, and rather just load your whole tileset in as an Image, along with using one or more SpriteBatch objects so things won't waste that much space.
Okay, i had a look, but the project's huge already...
While i didn't see any too obvious issues regarding creating tons of löve objects each update (which still might be the case though), i did notice your LoadTileset function creating both ImageDatas *and* Images for each tile you iterate over;
That in and of itself is both very RAM and VRAM heavy;
Consider not caring about ImageDatas at all, and rather just load your whole tileset in as an Image, along with using one or more SpriteBatch objects so things won't waste that much space.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Severe memory leak upon rendering player
In line 381 you're calling love.draw, which is the same event you're in. That should be love.graphics.draw.
-
- Prole
- Posts: 7
- Joined: Fri Dec 06, 2019 11:26 pm
Re: Severe memory leak upon rendering player
Ill consider trying something like that, i never even knew what sprite batches were until i read this post and looked it up. Thank you!zorg wrote: ↑Sat Feb 29, 2020 2:00 pm Hi and welcome to the forums.
Okay, i had a look, but the project's huge already...
While i didn't see any too obvious issues regarding creating tons of löve objects each update (which still might be the case though), i did notice your LoadTileset function creating both ImageDatas *and* Images for each tile you iterate over;
That in and of itself is both very RAM and VRAM heavy;
Consider not caring about ImageDatas at all, and rather just load your whole tileset in as an Image, along with using one or more SpriteBatch objects so things won't waste that much space.
Well. That explains alot. Thank you!
Who is online
Users browsing this forum: Bing [Bot] and 4 guests