-- 作者:admin
-- 发布时间:2008/9/22 22:51:32
-- 程序代码——获取内存信息
/* * Midlet.java * * Created on 2008年9月17日, 上午10:49 */
import javax.microedition.midlet.*; import javax.microedition.lcdui.*;
/** * * @author Administrator * @version */ public class Exec extends MIDlet { public void startApp() { Display display= Display.getDisplay(this); Form form = new Form("欢迎您!"); Runtime runtime=Runtime.getRuntime(); StringBuffer result=new StringBuffer(); result.append("total momery="+runtime.totalMemory()+"\\n"); result.append("free momery="+runtime.freeMemory()+"\\n"); runtime.gc(); result.append("free momery after gc="+runtime.freeMemory()+"\\n"); form.append(result.toString()); display.setCurrent(form); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } }
[此贴子已经被作者于2010-12-12 18:24:29编辑过]
|