Titanium Community Questions & Answer Archive

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

Android PhotoGallery error: Not enough memory to get image

Full error message: "Not enough Memory to get Image: bitmap exceeds VM budged"

How to reproduce:
Open Kitchen Sink and goto Phone/Photo Gallery

If you load a large image (say 3mpix) into the imageview, it is working fine. If you try to do that a second time, the above stated error appears.

That seems like some deallocate issue. Even if the window is closed (win.close()), the problem remains.

I thought that if the window is closed, all allocated memory to that window will be freed. That is obviously not the case.

Any hints on this are appreciated =)

— asked May 18th 2010 by Nils
  • android
  • memory
  • mobile
  • photogallery

2 Answers

  • Accepted Answer

    I have just unwound that error.
    It happens because it cant generate the event object (it lacks memory), so in my case it just doesnt call any callback function, and doesnt even give me an error.

    To be able to do select the image from the gallery the second time I used a workaround: assigned the imageview to the small 1 pixel local image. Then the old huge image was gone, memory freed, the new image could come in.

    — answered October 6th 2010 by Ganna Kozynenko
  • We'll look into it again. Believe it or not, we've been trying to figure out how to force free images for a long time. The memory for the image is actually allocated outside the JVM so you don't know that you're out of memory until the exception is thrown.

    — answered May 18th 2010 by Don Thorp
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.