Parcourir la source

[java] Added Gc

Caue Waneck il y a 12 ans
Parent
commit
14b3edc11c
1 fichiers modifiés avec 15 ajouts et 0 suppressions
  1. 15 0
      std/java/vm/Gc.hx

+ 15 - 0
std/java/vm/Gc.hx

@@ -0,0 +1,15 @@
+package java.vm;
+
+@:native('haxe.java.vm.Gc') class Gc
+{
+	public static function run( major : Bool )
+	{
+		java.lang.System.gc();
+	}
+
+	public static function stats() : { heap : Int, free : Int }
+	{
+		var r = java.lang.Runtime.getRuntime();
+		return { heap : r.totalMemory(), free : r.freeMemory() };
+	}
+}