Android Out of Memory Exception & Paused Activities -


i'm working on android app several activities. of time, app works fine, time time out of memory exception occurs. (usually when trying load large background image next activity)

i couldn't find obvious memory leaks, created heap dump when exception occurred (like described here) , tried analyse mat. haven't done before, wasn't sure should looking for. started clicking through larger byte objects , second 1 seems bitmap belonging imagebutton:

enter image description here

the path gc roots shows me com.android.internal.policy.impl.phonewindow instance:

enter image description here

the thing is, imagebutton in whole application in launch activity , between launch activity , crashing activity @ least 2 more activities.

so why image still in heap?? imagebutton defined in layout xml file using android:src attribute, nothing done via code there. there lot of other smaller objects earlier activities in heap.

i wrote little helloworld application , took in heap dump of , seems, android keeps objects of previous activities in heap. if case, out of memory exception has thrown day, guess must wrong on analysis :/

you might want @ bitmap managing in developer's documentation.

in particular: bitmap kept in memory long reference exists it. so, if absolutely have use large bitmaps buttons (as describing) might better loading manually , using recycle activity disappears sight.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -