浏览代码

added dumpMemory()

Nicolas Cannasse 9 年之前
父节点
当前提交
d1b01911cf
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      std/hl/Gc.hx

+ 9 - 0
std/hl/Gc.hx

@@ -30,6 +30,15 @@ class Gc {
 		return { totalAllocated : tot, allocationCount : count, currentMemory : mem };
 		return { totalAllocated : tot, allocationCount : count, currentMemory : mem };
 	}
 	}
 
 
+	/**
+		Dump whole memory into target filename for analysis.
+	**/
+	public static function dumpMemory( ?fileName : String = "hlmemory.dump" ) {
+		_dump(@:privateAccess fileName.toUtf8());
+	}
+
+	@:hlNative("std", "gc_dump_memory") static function _dump( b : hl.Bytes ) : Void {}
+
 	@:hlNative("std", "gc_profile") public static function activeProfileInfos( b : Bool ) : Void {}
 	@:hlNative("std", "gc_profile") public static function activeProfileInfos( b : Bool ) : Void {}
 	@:hlNative("std", "gc_enable") public static function enable( b : Bool ) : Void {}
 	@:hlNative("std", "gc_enable") public static function enable( b : Bool ) : Void {}
 	@:hlNative("std", "gc_major") public static function major() : Void {}
 	@:hlNative("std", "gc_major") public static function major() : Void {}