SNAPSHOT texture memory size

Okay, as i understand it a snapshot creates a single image of all it’s children. IT starts getting confusing in the docs when I see reference to snapshot’s children as well as snapshot’s canvas children.

If my snapshot was to start as a fullscreen image, then I continue adding images onto it, then deleting those children, would the texture memory of the snapshot keep increasing?

What I basically need to do is have a starting image (a full colour image), then keep adding images on top of it but I don’t want to increase the number of individual images held in memory.

I need to confirm that similar code to below does not increase the texture memory size of the snapshot nor the texture memory used by the app itself:

local w,h = display.contentWidth,display.contentHeight local snapshot = display.newSnapshot( w, h ) local painting = display.newImage( "painting.jpg" ) snapshot.canvas:insert( painting ) snapshot:invalidate( "canvas" ) display.remove(painting);painting=nil for i=1,100 do    local brush = display.newImage( "brush.png" )    brush.x=math.random(10,100)    brush.y=math.random(10,100)    brush.rotation=math.random(1,360)    snapshot.canvas:insert( brush )    snapshot:invalidate( "canvas" )    display.remove(brush);brush=nil end  

Lastly, since I am removing ‘brush’ from memory each time do I need to use snapshot.canvasMode at any point? Since the docs mention the default for canvas is “appending” the children to the snapshot’s group although based on the above code they would no longer exist. Or can I use snapshot.canvasMode=“discard” and not even need to bother manually removing ‘brush’ each time as “discard” should be removing them?

All a bit too confusing to figure out from the current docs. Any help appreciated.

Hey Jacques1, if you use canvasMode=“discard”, you don’t need to remove the brush instances - the memory consumption won’t change. You can use the following lib to view your memory and fps in realtime - https://github.com/GymbylCoding/CoronaCode/blob/master/PerformanceWatch.lua

P.S. You’ll need to modify the lib in order to use it with G2.

@nikraver, thanks for the reply, seems 2.0 might be worth looking at after all, even though it’s a huge pain to tweak code from 1.0.

Hey Jacques1, if you use canvasMode=“discard”, you don’t need to remove the brush instances - the memory consumption won’t change. You can use the following lib to view your memory and fps in realtime - https://github.com/GymbylCoding/CoronaCode/blob/master/PerformanceWatch.lua

P.S. You’ll need to modify the lib in order to use it with G2.

@nikraver, thanks for the reply, seems 2.0 might be worth looking at after all, even though it’s a huge pain to tweak code from 1.0.