Corona Profiler

I dont know where to ask this,
but since you are the developer of corona profiler,
I am just going to ask the question here (I don’t see much traffic in your website’s forum, some threads even have some spams in them).

I am new to corona, I have problem reading the memory test results that I get by running the profiler.

Any more details information on how to read and solve the memory problem in my code?

and another thing, how to get the memorytimeline in the glider to work?
Every time I run the memorytimeline it’s always empty.

Thank you. [import]uid: 31508 topic_id: 32206 reply_id: 332206[/import]

Hello Bpran,

Thanks for your question. Here is the general algorithm for detecting memory leaks

First find out if you truly do have a memory leak.
include this code snippet in your main

local monitorMem = function()  
  
 collectgarbage()  
 print( "MemUsage: " .. collectgarbage("count") )  
  
 local textMem = system.getInfo( "textureMemoryUsed" ) / 1000000  
 print( "TexMem: " .. textMem )  
end  
  
Runtime:addEventListener( "enterFrame", monitorMem )  

The best way to tell if you have a memory leak is to repetitively do a task that be undo-able. For example, going from your main menu to a game level and back to the main menu should be undo-able. Next do the transition multiple times and check the memory during each transition, if it is increasing at a constant rate every time then you have a leak.

If you do have a leak we suggest you use our Profiler with mode 4 and repeat the steps above that gave you the leak. The results will tell you which table is increasing (and therefore leaking.)

Here is a nice article describing where leaks come from:
http://www.coronalabs.com/blog/2011/08/15/corona-sdk-memory-leak-prevention-101/

Regards,
M.Y. Developers [import]uid: 55057 topic_id: 32206 reply_id: 128347[/import]

I tried using mode 4, but I can’t find any result html page in the sandbox folder (using on mac) [import]uid: 31508 topic_id: 32206 reply_id: 128348[/import]

Hello bpran,

Do you get a result with the other modes?
[import]uid: 55057 topic_id: 32206 reply_id: 128354[/import]

Yes mode 1, 2, 3 have the result page.
[import]uid: 31508 topic_id: 32206 reply_id: 128368[/import]

Hello Bpran,

Thanks for your question. Here is the general algorithm for detecting memory leaks

First find out if you truly do have a memory leak.
include this code snippet in your main

local monitorMem = function()  
  
 collectgarbage()  
 print( "MemUsage: " .. collectgarbage("count") )  
  
 local textMem = system.getInfo( "textureMemoryUsed" ) / 1000000  
 print( "TexMem: " .. textMem )  
end  
  
Runtime:addEventListener( "enterFrame", monitorMem )  

The best way to tell if you have a memory leak is to repetitively do a task that be undo-able. For example, going from your main menu to a game level and back to the main menu should be undo-able. Next do the transition multiple times and check the memory during each transition, if it is increasing at a constant rate every time then you have a leak.

If you do have a leak we suggest you use our Profiler with mode 4 and repeat the steps above that gave you the leak. The results will tell you which table is increasing (and therefore leaking.)

Here is a nice article describing where leaks come from:
http://www.coronalabs.com/blog/2011/08/15/corona-sdk-memory-leak-prevention-101/

Regards,
M.Y. Developers [import]uid: 55057 topic_id: 32206 reply_id: 128347[/import]

I tried using mode 4, but I can’t find any result html page in the sandbox folder (using on mac) [import]uid: 31508 topic_id: 32206 reply_id: 128348[/import]

Hello bpran,

Do you get a result with the other modes?
[import]uid: 55057 topic_id: 32206 reply_id: 128354[/import]

Yes mode 1, 2, 3 have the result page.
[import]uid: 31508 topic_id: 32206 reply_id: 128368[/import]

Hello Bpran,

“Yes mode 1, 2, 3 have the result page.”
Mode 4 should write a page called snapshot.html. Please check to see if it exists in the same place as the URL shown by modes 1,2, or 3.

Regards,
M.Y. Developers
[import]uid: 55057 topic_id: 32206 reply_id: 128809[/import]

the snapshot.html is empty.
nothing on it. [import]uid: 31508 topic_id: 32206 reply_id: 128814[/import]

@bpran,

How are you using mode 4? It is not as automatic as the others. You must define snapshot points in your code so it knows what to compare against.

Regards,
M.Y. Developers [import]uid: 55057 topic_id: 32206 reply_id: 128834[/import]

I use it just like the way I used mode 1 - 3, after the require.
Let me give it another try.

Thank you [import]uid: 31508 topic_id: 32206 reply_id: 128835[/import]

@bpran,

No problem. Please refer to the documentation for more information. Ideally you want to put a snapshot point at a place in your code that satisfies a few criteria:

  1. it is called repetitively
  2. each time it is called you expect the memory footprint to be the same (no leaks)

your main menu for instance is a good place to place the snapshots.

Regards,
M.Y. Developers [import]uid: 55057 topic_id: 32206 reply_id: 128842[/import]

Hello Bpran,

“Yes mode 1, 2, 3 have the result page.”
Mode 4 should write a page called snapshot.html. Please check to see if it exists in the same place as the URL shown by modes 1,2, or 3.

Regards,
M.Y. Developers
[import]uid: 55057 topic_id: 32206 reply_id: 128809[/import]

the snapshot.html is empty.
nothing on it. [import]uid: 31508 topic_id: 32206 reply_id: 128814[/import]

@bpran,

How are you using mode 4? It is not as automatic as the others. You must define snapshot points in your code so it knows what to compare against.

Regards,
M.Y. Developers [import]uid: 55057 topic_id: 32206 reply_id: 128834[/import]

I use it just like the way I used mode 1 - 3, after the require.
Let me give it another try.

Thank you [import]uid: 31508 topic_id: 32206 reply_id: 128835[/import]

@bpran,

No problem. Please refer to the documentation for more information. Ideally you want to put a snapshot point at a place in your code that satisfies a few criteria:

  1. it is called repetitively
  2. each time it is called you expect the memory footprint to be the same (no leaks)

your main menu for instance is a good place to place the snapshots.

Regards,
M.Y. Developers [import]uid: 55057 topic_id: 32206 reply_id: 128842[/import]

How to use and buy?