こんにちは、アンドロイドのヒープの成長に関係するエラーについて読んでください
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 を使用して保存します。しかし、それがここでどのように影響するかはわかりません。何か案は?