Simulator vs Devices TMP folder files

Howdy Y’all,

I have just noticed something odd with the folder generated by the simulator that stores an app’s Document & TMP folder.

The Document folder is storing my app’s save data no problem, so all good here.

However the TMP folder is filling up with thousands of files called “table/0x7f###########.jpg” (obviously named for the memory address of the table). I cleared it out and it generally creates about 5 of these files each time I test the ‘game’ scene of my app. i checked it today and after 1 day the folder was well over 3000 of these table files!

Question time:

Is this normal behaviour? If so why is the simulator not removing these files?

Does this also occur on devices? I hope not because I only need to save a small settings file and would hate to think that apps made by Corona eventually bloat up and waste space :confused:

I hope someone knows the answer to this :slight_smile:

PS just thought that I would add that I do indeed clean up my screen and destroy all objects/table etc after use

Regards,

Dave

@puredave72,

This is normal. I don’t think the simulator cleans up the TMP folder.

I handle this as follows:

  • Download the wonderful library GGFile from GlitchGames’ gitHub: https://github.com/GlitchGames/GGFile

  • Add the file GGFile.lua to your root folder (same as main.lua)

  • Add this code into your main.lua before you load any scenes or start running anything in your app that uses the TMP folder:
     

    local function purgeTmp() local GGFile = require “GGFile” local fileManager = GGFile:new() local files = fileManager:getFilesInDirectory( “”, system.TemporaryDirectory ) for i = 1, #files, 1 do print(files[i]) fileManager:delete( files[i], system.TemporaryDirectory ) end end purgeTmp()

** REMEMBER: When you go to release, comment out the call to purgeTmp() or this will clear out the TMP folder on each cold-start **

@roaminggamer

thanks for that, just to clarify, this is ONLY needed for the simulator, do not need the function for device builds?

Devices should clear out the temp folder automatically as they need the space.

@puredave72,

This is normal. I don’t think the simulator cleans up the TMP folder.

I handle this as follows:

  • Download the wonderful library GGFile from GlitchGames’ gitHub: https://github.com/GlitchGames/GGFile

  • Add the file GGFile.lua to your root folder (same as main.lua)

  • Add this code into your main.lua before you load any scenes or start running anything in your app that uses the TMP folder:
     

    local function purgeTmp() local GGFile = require “GGFile” local fileManager = GGFile:new() local files = fileManager:getFilesInDirectory( “”, system.TemporaryDirectory ) for i = 1, #files, 1 do print(files[i]) fileManager:delete( files[i], system.TemporaryDirectory ) end end purgeTmp()

** REMEMBER: When you go to release, comment out the call to purgeTmp() or this will clear out the TMP folder on each cold-start **

@roaminggamer

thanks for that, just to clarify, this is ONLY needed for the simulator, do not need the function for device builds?

Devices should clear out the temp folder automatically as they need the space.