The new version is released. The next day, we will see the feedback. One of the many errors is java. lang. outOfMemoryError: bitmap size exceeds VM budget. It is impossible for cainiao to modify this issue. I will look at how the boss can modify it. Memory overflow is generally caused by too many images. He is thinking about image loading and cleaning. He has never thought of similar problems in the pad version, why does the mobile phone version appear. After reading the pad version code, I suddenly thought that after the page Jump, I forgot to recycle the image cache and add it to the code.
[Java]
@ Override
Public void onDestroy (){
Super. onDestroy ();
If (checkImage! = Null ){
CheckImage. clearBitmap ();
}
}
The problem is solved. The checkImage variable is used to process image loading. Our client needs to use a lot of images. The processing method of images in the program is the first step. First, check whether there are loaded images in the memory, and then check the local (SD card) if there is no picture in the second step) is there any stored image in, and finally the request is sent to the server. The system will process the memory, but because the image is loaded more frequently, if you do not clean it manually, it is also prone to memory overflow.
ClearBitmap function:
[Java]
Public void <span style = "font-size: 18px;"> clear </span> Bitmap (){
If (hm! = Null ){
Try {
Iterator <Map. Entry <String, Bitmap> it = hm. entrySet (). iterator ();
While (it. hasNext ()){
Map. Entry <String, Bitmap> entry = it. next ();
Bitmap bm = entry. getValue ();
Bm. recycle ();
Bm = null;
}
Hm. clear ();
} Catch (Exception e ){
}
}
}
Another problem is the NULL pointer error Caused by: java. lang. nullPointerException: The frequency of this problem is also relatively large, but this problem is not self-resolved and is an occasional error. For such errors, all we need to do is ensure that the client does not crash, so find the row corresponding to the error, check the approximate location of the NULL pointer, and then use try catch to capture it, no other processing is required. This error does not affect ordering and viewing important information on the client.
Author: walker02