广交好友~~ 想要讨论的可以留下msn~~~
希望群友网友经常能提出问题,一起解决,共同提高
测试内存
上一篇 /
下一篇 2010-04-27 18:55:42
/ 个人分类:Java&C
import javax.microedition.midlet.*;import javax.microedition.lcdui.*;
public class HelloWorldMIDlet
extends MIDlet
implements CommandListener{
private Display display; private Form. props; private Command exitCommand=new Command("退出",Command.EXIT,1);
public HelloWorldMIDlet(){
display=Display.getDisplay(this);
}
public void startApp(){
props=new Form("Emulator Memory:");
props.append("This emulator :\n"); Runtime runtime = Runtime.getRuntime();
runtime.gc();
props.append("Free Memory : " + runtime.freeMemory()+"\n");
props.append("Total Memory : " + runtime.totalMemory()+"\n");
props.addCommand(exitCommand); props.setCommandListener(this); display.setCurrent(props);
}
public void commandAction(Command c,Displayable s)
{ if(c==exitCommand)
{ destroyApp(false); notifyDestroyed();
}
}
public void destroyApp (boolean unconditional)
{
} public void pauseApp() {} }
Runtime.getRuntime().freeMemory
收藏
举报
TAG: