List of usage examples for java.lang System runFinalization
public static void runFinalization()
From source file:Main.java
public static void main(String[] args) { System.runFinalization(); }
From source file:Main.java
public static void main(String[] args) throws Exception { System.out.println("finalization!"); System.runFinalization(); System.out.println("Done!"); }
From source file:com.l2jfree.gameserver.util.ModuleTester.java
public static void main(String[] args) throws Exception { Config.load();/*w w w.j a va2s.com*/ Config.DATAPACK_ROOT = new File("../l2jfree-datapack"); //L2DatabaseFactory.getInstance(); // here comes what you want to test //SkillTable.getInstance(); //HtmCache.getInstance(); //new WeaponSQLConverter().convert(); //convertSkills(); System.gc(); System.runFinalization(); Thread.sleep(1000); }
From source file:fr.certu.chouette.command.Command.java
/** * @param args/*from w w w .ja v a 2s . c om*/ */ public static void main(String[] args) { // pattern partially work String[] context = { "classpath*:/chouetteContext.xml" }; if (args.length >= 1) { if (args[0].equalsIgnoreCase("-help") || args[0].equalsIgnoreCase("-h")) { printHelp(); System.exit(0); } if (args[0].equalsIgnoreCase("-noDao")) { List<String> newContext = new ArrayList<String>(); PathMatchingResourcePatternResolver test = new PathMatchingResourcePatternResolver(); try { Resource[] re = test.getResources("classpath*:/chouetteContext.xml"); for (Resource resource : re) { if (!resource.getURL().toString().contains("dao")) { newContext.add(resource.getURL().toString()); } } context = newContext.toArray(new String[0]); dao = false; } catch (Exception e) { System.err.println("cannot remove dao : " + e.getLocalizedMessage()); } } applicationContext = new ClassPathXmlApplicationContext(context); ConfigurableBeanFactory factory = applicationContext.getBeanFactory(); Command command = (Command) factory.getBean("Command"); initDao(); command.execute(args); closeDao(); System.runFinalization(); } else { printHelp(); } }
From source file:Main.java
public static void killProcess() { android.os.Process.killProcess(android.os.Process.myPid()); System.gc(); System.runFinalization(); }
From source file:Main.java
public static void forceGCandWait() { Object obj = new Object(); WeakReference ref = new WeakReference<>(obj); obj = null;/* w w w. java 2 s. c o m*/ System.gc(); System.runFinalization(); /** wait for garbage collector finished*/ while (ref.get() != null) try { Thread.sleep(100); } catch (InterruptedException e) { } //System.gc(); }
From source file:Main.java
public static void recycleBitmap(Bitmap mBitmap) { if (mBitmap != null && !mBitmap.isRecycled()) { mBitmap.recycle();//w w w .j a v a 2 s . co m mBitmap = null; System.gc(); System.runFinalization(); System.gc(); } }
From source file:Main.java
public static Bitmap createBitmap(int width, int height, Bitmap.Config config) { Bitmap bitmap = null;//ww w . jav a2s.com try { bitmap = Bitmap.createBitmap(width, height, config); } catch (OutOfMemoryError e) { while (bitmap == null) { System.gc(); System.runFinalization(); bitmap = createBitmap(width, height, config); } } return bitmap; }
From source file:Main.java
public static void recycleBitmapArr(Bitmap[] bmps) { for (int i = 0; i < bmps.length; i++) { Bitmap mBitmap = bmps[i];//from ww w .ja v a 2s. c o m if (mBitmap != null && !mBitmap.isRecycled()) { mBitmap.recycle(); mBitmap = null; System.gc(); System.runFinalization(); System.gc(); } } }
From source file:fr.certu.chouette.gui.command.Command.java
/** * @param args/*w w w . j av a 2s . c om*/ */ public static void main(String[] args) { // pattern partially work String[] context = { "classpath*:/chouetteContext.xml" }; if (args.length >= 1) { if (args[0].equalsIgnoreCase("-help") || args[0].equalsIgnoreCase("-h")) { printHelp(); System.exit(0); } applicationContext = new ClassPathXmlApplicationContext(context); ConfigurableBeanFactory factory = applicationContext.getBeanFactory(); Command command = (Command) factory.getBean("Command"); initDao(); command.execute(args); closeDao(); System.runFinalization(); } else { printHelp(); } }