喜iv'e對具有機器人的Android堆重新啓動應用程序時
08-13 21:46:22.382: I/dalvikvm-heap(10859): Grow heap (frag case) to 20.578MB for 2400016-byte allocation
下面成長堆做錯誤周圍看的是日誌(過濾)成長在那裏我反覆剛剛復出了我的申請,並開始它一遍又一遍。正如你所看到的,每次重啓都會增加堆。怎麼可能?完全退出時,應用程序堆不應該清除嗎?
如果我在代碼中進行任何更改並重新啓動應用程序,堆將重置爲其原始值。這種行爲是否正常?
每當我在應用程序中切換活動時,也會發生同樣的堆增長。我在andengine中編寫了我的應用程序。我得到了80MB的堆,並且裝載量更大,裝載量更大。
I/dalvikvm-heap(13094): Grow heap (frag case) to 13.198MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 13.354MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 13.350MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 13.350MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 13.406MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 13.268MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 13.265MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 13.264MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 14.818MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 14.814MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 14.813MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 14.813MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 16.421MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 16.427MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 16.426MB for 2400016-byte allocation
I/dalvikvm-heap(13094): Grow heap (frag case) to 16.426MB for 2400016-byte allocation
//**-Not A log message: here i simply changed a variables name and restarted**
I/dalvikvm-heap(13497): Grow heap (frag case) to 12.995MB for 2400016-byte allocation
I/dalvikvm-heap(13497): Grow heap (frag case) to 13.002MB for 2400016-byte allocation
I/dalvikvm-heap(13497): Grow heap (frag case) to 13.002MB for 2400016-byte allocation
I/dalvikvm-heap(13497): Grow heap (frag case) to 13.002MB for 2400016-byte allocation
這就像關閉應用程序後保留的內存泄漏,在應用程序中,我使用sharedPreferences來保存內容。但是我沒有看到這可以在這裏產生效果。有任何想法嗎?
http://www.eclipse.org/mat/ – Mike 2012-08-13 20:40:13
圖片?調用回收? – Doomsknight 2012-08-13 20:45:46
@mike,是的,我試過了,做了一些堆轉儲。但我真的不明白,你說什麼叫回收? – Adam 2012-08-13 22:01:55