Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How should I do to release the memory in the image from cashe?

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?

— asked November 15th 2010 by Akiyoshi Hanaoka
  • cache
  • image
  • memory
  • release
  • scrollableview
  • titanium

5 Answers

  • 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.

    — answered November 15th 2010 by sean oreilly
  • 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)

    — answered December 8th 2010 by Patrick van Zadel
  • 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 ..

    — answered November 18th 2010 by Jan Renz
    1 Comment
    • have you modified your scrollableviewclass yourself? i would gladly pay for it to avoid the hassle. otherwise your saying assign all views to null? thanks

      — commented November 18th 2010 by sean oreilly
  • 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!

    — answered December 8th 2010 by Farid Fadaie
  • I think this might help you.



    — answered February 3rd 2011 by Manaday Mavani
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.