現在開發了幾個星期的Android應用程序,我只是意識到,我得到了在目錄下載這樣的消息:Jit:將JitTable的大小從512調整爲1024,等等......這是什麼?
Jit: Resizing JitTable from 512 to 1024
(...)
Jit: Resizing JitTable from 1024 to 2048
(...)
Jit: Resizing JitTable from 2048 to 4096
它是什麼意思?這是內存泄漏還是類似的東西?
我在(...)面積也得到了這一點:
04-24 07:59:53.131: D/dalvikvm(874): GC_EXTERNAL_ALLOC freed 207K, 48% free 2980K/5639K, external 1448K/1458K, paused 66ms
04-24 07:59:57.591: D/dalvikvm(874): GC_CONCURRENT freed 162K, 46% free 3122K/5767K, external 1371K/1673K, paused 11ms+17ms
04-24 07:59:58.771: D/dalvikvm(874): GC_CONCURRENT freed 196K, 44% free 3445K/6087K, external 1145K/1657K, paused 10ms+6ms
04-24 08:00:01.411: D/dalvikvm(874): GC_CONCURRENT freed 274K, 39% free 4267K/6983K, external 1145K/1657K, paused 6ms+7ms
04-24 08:00:04.970: D/dalvikvm(874): GC_EXTERNAL_ALLOC freed 31K, 36% free 4479K/6983K, external 1145K/1657K, paused 89ms
約14%的自由,我有一個崩潰。
發生這種情況時,我單擊菜單按鈕(改變活動)。 我測試的模擬器,不知道結果的電話......
在碰撞中的logcat錯誤:
04-24 08:26:34.158: E/GraphicsJNI(482): VM won't let us allocate 1536000 bytes
04-24 08:26:34.158: D/dalvikvm(482): GC_FOR_MALLOC freed 0K, 64% free 4280K/11655K, external 11662K/13614K, paused 72ms
04-24 08:26:34.158: D/skia(482): --- decoder->decode returned false
04-24 08:26:34.168: D/AndroidRuntime(482): Shutting down VM
04-24 08:26:34.168: W/dalvikvm(482): threadid=1: thread exiting with uncaught exception (group=0x40015560)
04-24 08:26:34.218: E/AndroidRuntime(482): FATAL EXCEPTION: main
04-24 08:34:37.807: E/AndroidRuntime(522): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-24 08:26:34.218: E/AndroidRuntime(482): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.KeySoft.OpenGuide/com.KeySoft.OpenGuide.Favourites}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
04-24 08:34:37.807: E/AndroidRuntime(522): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:284)
04-24 08:34:37.807: E/AndroidRuntime(522): at com.KeySoft.OpenGuide.Top20.readBitmapImage(Top20.java:483)
04-24 08:34:37.807: E/AndroidRuntime(522): at com.KeySoft.OpenGuide.Top20.addShopToList(Top20.java:251)
04-24 08:34:37.807: E/AndroidRuntime(522): at com.KeySoft.OpenGuide.Top20.SqlShopsVissza(Top20.java:439)
04-24 08:34:37.807: E/AndroidRuntime(522): at com.KeySoft.OpenGuide.Top20.onCreate(Top20.java:182)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.os.Looper.loop(Looper.java:130)
04-24 08:34:37.807: E/AndroidRuntime(522): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-24 08:34:37.807: E/AndroidRuntime(522): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 08:34:37.807: E/AndroidRuntime(522): at java.lang.reflect.Method.invoke(Method.java:507)
04-24 08:34:37.807: E/AndroidRuntime(522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-24 08:34:37.807: E/AndroidRuntime(522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-24 08:34:37.807: E/AndroidRuntime(522): at dalvik.system.NativeStart.main(Native Method)
我使用256 MB RAM的模擬器......也許我能避免這一切真正的設備? 便宜的設備也有至少384 MB RAM(銀河迷你),但oftem更多...
這就告訴你你正在使用內存。如果你的應用程序崩潰發佈你得到的錯誤消息。這些只是關於垃圾收集和即時編譯器的信息。儘管你可能會使用太多的內存或者泄漏。 – zapl 2012-04-24 08:13:24
編輯我的問題 – 2012-04-24 08:30:32
我猜你正在使用大圖片。某處與第2行佈局xml文件相關。由於每個應用的內存是有限的(像16MB那樣),所以在使用圖像時必須非常保守。 1百萬像素(1000×1000)圖像需要4兆RAM。 – zapl 2012-04-24 08:38:16