|
@@ -31,7 +31,7 @@ enum GcFlag {
|
|
**/
|
|
**/
|
|
DumpMem;
|
|
DumpMem;
|
|
/**
|
|
/**
|
|
- Enable block tracking (see Gc.track API)
|
|
|
|
|
|
+ Enable allocation tracking
|
|
**/
|
|
**/
|
|
Track;
|
|
Track;
|
|
}
|
|
}
|
|
@@ -46,31 +46,6 @@ class Gc {
|
|
return { totalAllocated : tot, allocationCount : count, currentMemory : mem };
|
|
return { totalAllocated : tot, allocationCount : count, currentMemory : mem };
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- Start tracking an object field change.
|
|
|
|
- The check will be performed every allocation and the callback function triggered everytime
|
|
|
|
- a change has been performed since last check. The callback parameter is true if the object was collected.
|
|
|
|
- It is necessary to enable the Track flag in Gc.flags
|
|
|
|
- **/
|
|
|
|
- public static function track( obj : Dynamic, field : String, callb : Dynamic -> Bytes -> Void ) {
|
|
|
|
- var oval = if( Reflect.isFunction(obj) ) Api.getClosureValue(obj) else obj;
|
|
|
|
- var fid = if( ~/^[0-9]+$/.match(field) ) Std.parseInt(field) else @:privateAccess field.bytes.hash();
|
|
|
|
- if( !_track(oval, fid, callb) )
|
|
|
|
- throw "Could not track "+obj+"."+field;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public static function untrack( obj : Dynamic ) {
|
|
|
|
- var oval = if( Reflect.isFunction(obj) ) Api.getClosureValue(obj) else obj;
|
|
|
|
- return _untrack(oval);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @:hlNative("std", "gc_untrack_all") public static function untrackAll() : Void {
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @:hlNative("std", "gc_track_count") public static function trackCount() : Int {
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
Dump whole memory into target filename for analysis.
|
|
Dump whole memory into target filename for analysis.
|
|
**/
|
|
**/
|
|
@@ -92,8 +67,6 @@ class Gc {
|
|
@: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 {}
|
|
@:hlNative("std", "gc_stats") static function _stats( totalAllocated : hl.Ref<Float>, allocationCount : hl.Ref<Float>, currentMemory : hl.Ref<Float> ) : Void {}
|
|
@:hlNative("std", "gc_stats") static function _stats( totalAllocated : hl.Ref<Float>, allocationCount : hl.Ref<Float>, currentMemory : hl.Ref<Float> ) : Void {}
|
|
- @:hlNative("std", "gc_track") static function _track( obj : Dynamic, fid : Int, callb : Dynamic -> Bytes -> Void ) : Bool { return false; }
|
|
|
|
- @:hlNative("std", "gc_untrack") static function _untrack( obj : Dynamic ) : Bool { return false; }
|
|
|
|
|
|
|
|
@:hlNative("std", "gc_get_flags") static function _get_flags() : Int { return 0; }
|
|
@:hlNative("std", "gc_get_flags") static function _get_flags() : Int { return 0; }
|
|
@:hlNative("std", "gc_set_flags") static function _set_flags( v : Int ) {}
|
|
@:hlNative("std", "gc_set_flags") static function _set_flags( v : Int ) {}
|