0

I would like to make an mobile application, what contains a lot of picture My question how can I dynamically open the picture and delete from memory?

I tested this:

a = Texture.new("a.jpg")
print(Application:getTextureMemoryUsage()) -- write x
a = nil
print(Application:getTextureMemoryUsage()) -- write x again

Thanks for help.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
somla
  • 11
  • 3

1 Answers1

1

Problem is that garbage is not collected right away and that is why memory is not freed right away. You could try calling collectgarbage() couple of times to force it as:

print(math.floor(collectgarbage("count")))
collectgarbage()
collectgarbage()
collectgarbage()
print(math.floor(collectgarbage("count")))
Artūrs Sosins
  • 579
  • 5
  • 21