File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- 2060
1+ 2069
Original file line number Diff line number Diff line change @@ -16,14 +16,14 @@ class Strum extends FlxSprite {
1616
1717 public var lastDrawCameras (default , null ): Array <FlxCamera > = [];
1818
19- public function getScrollSpeed (? note : Note ) {
19+ public inline function getScrollSpeed (? note : Note ): Float {
2020 if (note != null && note .scrollSpeed != null ) return note .scrollSpeed ;
2121 if (scrollSpeed != null ) return scrollSpeed ;
2222 if (PlayState .instance != null ) return PlayState .instance .scrollSpeed ;
2323 return 1 ;
2424 }
2525
26- public function getNotesAngle (? note : Note ) {
26+ public inline function getNotesAngle (? note : Note ): Float {
2727 if (note != null && note .noteAngle != null ) return note .noteAngle ;
2828 if (noteAngle != null ) return noteAngle ;
2929 return angle ;
Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ class Main extends Sprite
129129 }
130130
131131 public function loadGameSettings () {
132+ MemoryUtil .init ();
132133 @:privateAccess
133134 FlxG .game .getTimer = getTimer ;
134135 #if ALLOW_MULTITHREADING
@@ -244,6 +245,7 @@ class Main extends Sprite
244245
245246 Paths .assetsTree .clearCache ();
246247
248+ MemoryUtil .destroyFlixelZombies ();
247249 MemoryUtil .clearMajor ();
248250 }
249251}
Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ import neko.vm.Gc;
1212import openfl .system .System ;
1313
1414class MemoryUtil {
15+ public static function init () {
16+ #if cpp
17+ // cpp.NativeGc.addFinalizable(new MemoryUtil(), false);
18+ #end
19+ }
1520 public static function clearMinor () {
1621 #if (cpp || java || neko)
1722 Gc .run (false );
@@ -50,4 +55,25 @@ class MemoryUtil {
5055 return 0 ;
5156 #end
5257 }
58+
59+ private static var _nb : Int = 0 ;
60+ private static var _nbD : Int = 0 ;
61+ private static var _zombie : Dynamic ;
62+
63+ public static function destroyFlixelZombies () {
64+ #if cpp
65+ Gc .enterGCFreeZone ();
66+
67+ while ((_zombie = Gc .getNextZombie ()) != null ) {
68+ _nb ++ ;
69+ if (_zombie is flixel.util. FlxDestroyUtil . IFlxDestroyable ) {
70+ flixel.util. FlxDestroyUtil .destroy (cast (_zombie , flixel.util. FlxDestroyUtil . IFlxDestroyable ));
71+ _nbD ++ ;
72+ }
73+ }
74+ Sys .println (' Zombies: ${_nb }; IFlxDestroyable Zombies: ${_nbD }' );
75+
76+ Gc .exitGCFreeZone ();
77+ #end
78+ }
5379}
You can’t perform that action at this time.
0 commit comments