Android Question What is proper way to handle 1000+ HD images?

Pendrush

Well-Known Member
Licensed User
Longtime User
I want to make app similar to this.
I know how to make everything, but don't know proper way to handle 1000+ HD images without triggering Out Of Memory error.
Can anyone recommend way how to load and release images by releasing memory they occupied?
 

Peter Simpson

Expert
Licensed User
Longtime User
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
I know for that, but problem is even when you resize image. Loading 1000+ or 5000+ will trigger OOM even images is not HD or they are resized. I can see in Android Monitor how app use more and more memory for every new loaded image in same ImageView.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Well you can just optimise the images before saving them then load them up resizes, you will not get any out of memory issues then.

What size are the saved images?
 
Last edited:
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
Loading different image in same ImageView leave reference "live" from previous loaded image. As I continue to load different image in same ImageView, memory consumption start to grow as reference for every loaded image is still "live". I need a way to "break" reference from previous loaded image in that particular ImageView.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
As I continue to load different image in same ImageView, memory consumption start to grow as reference for every loaded image is still "live". I need a way to "break" reference from previous loaded image in that particular ImageView.
The question is, has your application died because of too many images? What makes you think that the image is "live". Java and most likely Android's Dalvik/ART are lazy in collecting garbage (only doing it when forced to).

Ignore the above, I really need to read better
I know for that, but problem is even when you resize image. Loading 1000+ or 5000+ will trigger OOM even images is not HD or they are resized.
 
Last edited:
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
Loading different image in same ImageView leave reference "live" from previous loaded image.
do you have an example how you doing this?
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Hi Pendrush,

Everybody tried to help you in 1000+ images problem. But problem was some where else. Will you please elaborate the problem and the solution. This may help newbies like me.

Regards,

Anand
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
Hi Pendrush,

Everybody tried to help you in 1000+ images problem. But problem was some where else. Will you please elaborate the problem and the solution. This may help newbies like me.

Regards,

Anand
Problem is in the Map (as it get larger and larger), totally unrelated with my first suspicions.
So it's coding error, nothing related with images.
 
Upvote 0
Top