ccrama
ccrama

Reputation: 754

Lots of RAM use by very large byte arrays?

I have been trying to fix a memory leak in my app for a long time, and I keep running into dead ends. The app is heavily image-centric, so I use the Picasso library to handle caching and memory use. I passed the high ram use (up to 100-170mb for my app) to bad memory management on Picasso's part, but I did some testing and disabled memory caching for Picasso, which loads all my images, and there was not a very noticable drop in RAM usage. It was still using 90 to upwards of 170 mb of RAM. I did a full heap dump into a hprof file and opened it with MemoryAnalyzer to see this: http://i.gyazo.com/6b8d884852fa7cae546fc4cad1fc44c9.png.

If I go to Path to GC Roots, it shows no roots and no parents. There is no link to any of these over 50,000,000 bytes in these 25 massive byte arrays, and I really don't know where to start looking for the cause of it. Do you have any suggestions on what the bug could be and any possible fixes?

Thank you very much for helping me out!

Upvotes: 2

Views: 1397

Answers (1)

Artem Zinnatullin
Artem Zinnatullin

Reputation: 4447

Try to use LeakCanary to find the memory leak.

Also, you can try Fresco for image loading & displaying, it stores images in the native memory region, so you won't use too much memory from the managed region, GC won't take too much time and you could avoid OutOfMemoryErrors.

Upvotes: 1

Related Questions