Friday, June 8, 2012

Corona SDK Memory Leak Prevention 101

Corona SDK Memory Leak Prevention 101
What is Memory Management?
Memory management in Corona is simply managing the following five things:
  1. Display objects
  2. Global variables
  3. Runtime listeners
  4. Timers
  5. Transitions
다음 코드를 main.lua 맨 밑에 넣으면 됨
 local monitorMem = function()  
   
   collectgarbage()  
   print( "MemUsage: " .. collectgarbage("count") )  
   
   local textMem = system.getInfo( "textureMemoryUsed" ) / 1000000  
   print( "TexMem:  " .. textMem )  
 end  
   
 Runtime:addEventListener( "enterFrame", monitorMem )  
키워드 : garbage collection, collectgarbage

No comments:

Post a Comment