Hi,
I have added 50ms delay between each fill operation in the loop which fills the empty Rects. In the demo links below I fill each Rect as soon as it enters the screen and “unfill” it, i.e. release the texture memory as soon as it leaves the screen.
With BitmapPaint fill activated:
https://drive.google.com/open?id=1_HzU2a-mybEP_SCFP7NxoliauRcn_TxM
With BitmapPaint fill disabled:
https://drive.google.com/open?id=1w40A74DVvkFq7KOl39bSZ4fM52o6N4tO
The only difference in the code base is:
spock:Corona jocke$ svn diff widgets/attachmentslistwidget.lua =================================================================== --- widgets/attachmentslistwidget.lua (revision 870) +++ widgets/attachmentslistwidget.lua (working copy) @@ -201,12 +202,15 @@ elseif options.filename ~= nil and options.baseDir ~= nil then removeProgress() if options.delay == nil then +--[[ frame.fill = { type = "image", filename = options.filename, baseDir = options.baseDir } +--]] else +--[[ timer.performWithDelay( options.delay, function() @@ -216,6 +220,7 @@ baseDir = options.baseDir } end) +--]]
I also check the memory usage with the following snippet:
local function checkMem() collectgarbage("collect") local memoryUsed = collectgarbage("count") local maxTextureSize = system.getInfo("maxTextureSize") local textureMemoryUsed = system.getInfo("textureMemoryUsed") / 1048576 print("====") print("System Memory:", string.format("%.00f", memoryUsed) .. " kB") print("Max Texture Size:", maxTextureSize) print("Texture Memory:", string.format("%.03f", textureMemoryUsed) .. " MB") end timer.performWithDelay(4000, checkMem, -1)
And with BitmapPaint fill activated it gave me:
==== System Memory: 2308 kB Max Texture Size: 16384 Texture Memory: 60.225 MB
The images I use are these (sorry for the theme, got bored):
-rw-r--r--@ 1 jocke staff 61661 27 Apr 2017 lenin.jpeg -rw-r--r--@ 1 jocke staff 284992 27 Apr 2017 lenin.png -rw-r--r--@ 1 jocke staff 519158 27 Apr 2017 lenin2.jpeg lrwxr-xr-x 1 jocke staff 34 23 Maj 2017 snowden.jpg -\> ../../../../../docroot/snowden.jpg -rw-r--r--@ 1 jocke staff 732648 24 Apr 2017 sovjet.jpg -rw-r--r--@ 1 jocke staff 822548 21 Apr 2017 spiderman.png spock:images jocke$ ls -l ../../../../../docroot/snowden.jpg -rw-r--r-- 1 jocke staff 28404 13 Feb 2017 ../../../../../docroot/snowden.jpg
In summary: The filling operations seem to choke the main thread.
I might add that I do not use https://docs.coronalabs.com/api/library/widget/newScrollView.html but instead use my own scroll module in order to be able fine tune the look and feel down to the last pixel/transition/timing. It works nicely but maybe this is the culprit here? Maybe Corona’s ScrollView does magic stuff to offload the main thread, i.e. using posix threads or whatnot? I do nothing magic in my scroll implementation: https://drive.google.com/open?id=1i08xdV79RI8k90EOoURKoSYRFOUl51GM
Can you see something broken in all of this? Sigh.
Cheers
/Joakim