I have been using ProFi to profile the running time of functions, which has been helpful; but is there anyway to investigate the memory allocations/dellocations/usages?
thanks in advance
How do i profile memory usage in love2d?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: How do i profile memory usage in love2d?
Yes, there is.
Just use collectgarbage, passing it 'count' as argument.
Just use collectgarbage, passing it 'count' as argument.
Code: Select all
function love.draw()
love.graphics.print('Memory actually used (in kB): ' .. collectgarbage('count'), 10,10)
end
Re: How do i profile memory usage in love2d?
LÖVE does only use the memory of the Lua task?
It doesn't need more?
It doesn't need more?
"Docendo discimus" - Lucius Annaeus Seneca
Re: How do i profile memory usage in love2d?
collectgarbage('count') shows the amount of memory that Lua is responsible for (i.e. stored in the lua_state, and subject to garbage collection). If you're using threads, it won't show what the other threads are using, and it won't (shouldn't) show what Love is using internally. Though, anything love stores in the lua Registry, that stuff could be counted, depending on how it's stored.
And interesting note about displaying that number this way (string concat operator), is that it impacts memory usage, meaning that the rate of memory growth displayed will be faster than it would actually be without the display. So, don't freak out when your process is shooting through memory like it's going out of style. What should concern you more is how often a GC cycle happens, which you'll notice as a sudden drop in the amount of memory used. GC cycles have the biggest impact on performance.Roland_Yonaba wrote:Code: Select all
function love.draw() love.graphics.print('Memory actually used (in kB): ' .. collectgarbage('count'), 10,10) end
Who is online
Users browsing this forum: Google [Bot], Nikki and 9 guests