I don't know if you have seen the "decompilation of Siberian attacks" Source code " Code Okay, I don't know how powerful its authority is, but it is still famous to attack the game in Siberia. It may be worth looking.
Its main engine is to declare a static image array: Class Mainengine Extends Fullcanvas
Implements Runnable
{
....
Static Image IMGs [];
Public Static Void Initimage () {
If ( ! Isloadimg) {
If (IMGs = Null )
IMGs = New Image [gamedata. imgname. Length];
For ( Int I = 0 ; I < Gamedata. imgname. Length - 1 ; I ++ ) {
If (IMGs [I] = Null ) {
Try {
IMGs [I]=Image. createimage ("/" +Gamedata. imgname [I]);
}
Catch (Exception ex) {
System. Out. println ("I:"+I );
Ex. printstacktrace ();
}
}
Percent = (I * 100 ) / (Gamedata. imgname. Length - 1 );
SIB. Engine. flushgraphic ();
}
Isloadimg = True ;
}
}
And I searched its five java files. Under what circumstances does it call system. GC?
The following three situations:
When the user returned to the game (maybe he had answered the call before? Or is the parameter changed ?);
After the user selects an airplane, this may be an option menu. The resources used when selecting an airplane may not be used in the game in the future, so they can recycle it in time;
When the interface is displayed, there is a card at this time, and happy users do not care.
No more.
Nokia documentationKnown issues in the Nokia 6600 MIDP 2.0 implementation v1.7Said:
2.15.1 garbage collecting
Description
Calling the system. GC () method results in extreme slowness and jamming. In Monty 1.0 Vm, garbage
Collection is different and every time system. GC is called, the entire memory is really cleared.
This is an extremely slow process!
Solution
Do not call the system. GC method at all, or call the system. GC () garbage collecting method only
In non-time-critical situations, such as screen transitions, state transitions, pause states,
Etc. If the system. GC () method is used, it is recommended to add a short delay (~ 20-50 MS) after
The method call to ensure the sufficient time for the garbage collection, as in the following
Example
System. GC ();
Thread. Sleep (Delay); delay = 20-50 MS