I have a memory leak in my game.. :'3
I'm not techincally versed in this stuff, how do I fix this?
I think its caused by mismanaged sprite data
https://cdn.discordapp.com/attachments/ ... -02-48.mp4
Will provide any code or anything else
Memory leak..... Help....
- BrotSagtMist
- Party member
- Posts: 659
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Memory leak..... Help....
Please dont post videos of such questions.
First glance, i dont see what you mean, thats how Lua operates normally.
But if you want to have your code sanity checked, you need to paste code.
First glance, i dont see what you mean, thats how Lua operates normally.
But if you want to have your code sanity checked, you need to paste code.
obey
Re: Memory leak..... Help....
some maybe obvious questions, but:
- are you remembering to remove entries from your notes table when they move offscreen?
- are you creating duplicates of the sprite (eg. every frame as opposed to just when you initialize)?
without any code, we can't really do anything except guess at what the causes might be.
- are you remembering to remove entries from your notes table when they move offscreen?
- are you creating duplicates of the sprite (eg. every frame as opposed to just when you initialize)?
without any code, we can't really do anything except guess at what the causes might be.
- Amatereasu
- Prole
- Posts: 9
- Joined: Wed May 10, 2023 6:30 am
Re: Memory leak..... Help....
the memory usage rises and rises until it just crashes my PC lolBrotSagtMist wrote: ↑Sat May 13, 2023 8:32 am Please dont post videos of such questions.
First glance, i dont see what you mean, thats how Lua operates normally.
But if you want to have your code sanity checked, you need to paste code.
in the clip im spawning the hearts, and when they go off screen theyre supposed to despawn:deströyer wrote: ↑Sat May 13, 2023 3:27 pm some maybe obvious questions, but:
- are you remembering to remove entries from your notes table when they move offscreen?
- are you creating duplicates of the sprite (eg. every frame as opposed to just when you initialize)?
without any code, we can't really do anything except guess at what the causes might be.
in love.load:
Code: Select all
function noteSpawn(x, y, s)
local note = {x = x, y = y, s = s}
table.insert(notes, note)
end
Code: Select all
for i, note in ipairs(notes) do
note.x = note.x - (note.s * 100) * dt
if note.x < 0 then
table.remove(notes, i)
end
end
Code: Select all
for i, note in ipairs(notes) do
love.graphics.draw(noteSpritesheet, note.x, note.y, nil, 4, 4, 12, 12)
end
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests