I am developing the book that consists of 102 images by using scrollableView. However, it worries due to the problem of collecting of the image in cache, and will stop before long.
Therefore, whenever the page is sent, I want to release the image on the previous page. However, there is no one like "release" in titanium.
How should I do to release the memory in the image?
no one is going to help you. ive been asking for help on this issue for days. I'm probably going to go back to objective c today. sucks.
Yes it is possible to say that only the current and previous and next pages are loaded, then every image/view after that has a image = ""
You can also, write classes for it to only draw the page you open and maybe a class that release any page that goes away or isn't visible.
as for the window closed stuff that Farid is talking about.
it should work that way.
in Obj-c every element that is created gets a "retain" count (you actually call it with retain in obj-c), but when these get loaded in a master view/window (window url in this case) then the "master" window should hold the retain for all its childs, and when the window gets closed/released the retain goes to 0 and obj-c calles Dealloc automatically.
But in obj-c whenever you do it this way, so create an element and add it to a view you also should release the same object straight away cause the retain count is hold on by the master view/window, I didn't have a look at the Titanium git or code so I don't know how they handle these things.
also I know C++/C# and now am learning obj-c too so I'm not even sure how to code in obj-c yet.
As far as this explanation goes I know that in Titanium whenever you add views to a different "master" view and close the "master" view it does release the memory for all it's childs.
But I don't know how that goes in a scrollable view…
otherwise here are some topics that might help:
and a code im working on at the moment (this definitly a work in progress but maybe you can figure something out)
Either you optimize the ScrollableViewClass or you have do overwrite the nonvisible views with an empty view. I made an pro supoort ticket for that , but this may take some weeks to be fixed.
so if you feel like coding some objective c, fork the code on github and refactor it there ..
Same issue with us. It's a huge deal. How should we release the memory taken by the image objects? I've even tried putting the ScrollableView in a window and close the window. Apparently the garbage collector is not acting on it and doesn't release the memory.
I am starting to think that the only plausible way, at this moment, is to have them all in a separate js file in a separate context. If the window is closed in this case, it might actually release the memory (I am hoping). Haven't tried it though. Even if it works, it's extremely more restrictive than a properly implemented garbage collector!
I think this might help you.