Pushjet / Pushjet-Android

The Pushjet android client
BSD 2-Clause "Simplified" License
135 stars 21 forks source link

Crashing when opening app #9

Open potchin opened 8 years ago

potchin commented 8 years ago

I have submitted a report via the android feedback mechanism but no idea if its ended up in the right hands.

The app installed fine and I was able to subscribe to my channel. After a few days I can no longer open the app. It immediately crashes with ..

Exception class name: java.lang.OutOfMemoryError Source file: VMRuntime.java Source Class dalvik.system.VMRuntime Line number -2

My device has plenty of RAM available and the same occurs immediately after a reboot. Strangely I still receive notifications from my subscriptions as normal, its just opening the app which doesnt work. After uninstalling and reinstalling it works for a few days then the problem reoccurs.

Running CyanagenMod 13 (MM) on a OnePlus One

Mechazawa commented 8 years ago

Sorry, I don't go on the developer console a lot so I generally don't see them. The way the app currently handles images is pretty optimized. It reserves memory for each instance instead of sharing. I assume that you have a lot of notifications that it tries to load when you open the app.

I might be able to rewrite this portion this weekend.

potchin commented 8 years ago

There shouldnt be that many notifications, maybe 6 per day, all from the same channel.

I just "reported" it via android again a few minutes ago if you want more info.

potchin commented 8 years ago

I just checked and the image for my service is 39.55 kB. Hoping thats not too big

Mechazawa commented 8 years ago

For some reason it tries to allocate ~ 23MB per image which is a lot! I'll have a look as soon as I have time from work.

potchin commented 8 years ago

Wow, that is a lot. Guessing you have this info from the crash report but the image im using for my channel is...

https://openclipart.org/image/2400px/svg_to_png/217511/1429747035.png

Mechazawa commented 8 years ago

Just did a quick and dirty check and it looks about accurate

 ~/Downloads> convert 1429747035.{png,bmp}
 ~/Downloads> ls -lh 1429747035.*
-rw-r--r-- 1 shodan shodan 22M Aug  4 21:02 1429747035.bmp
-rw-r--r-- 1 shodan shodan 40K Aug  4 21:02 1429747035.png
potchin commented 8 years ago

Ah, didnt realise it coverted to bmp. The resolution is massive (2,400px × 2,400px ) so thats no surprise. I'm gonna update my channel to have a lower resolution image.

Guess its still a bug but it makes sense knowing the image is converted to a bitmap.

Mechazawa commented 8 years ago

Still a bug none the less. I vaguely remember building in resizing into the app. But from what I can remember I only did it in the notification tray... Should be a quick and simple patch,

Mechazawa commented 8 years ago

Quick sidenote: Internally applications will in general convert images to bitmap representations because it's fast and easier to manage.