Skip to content

Commit 3c513bc

Browse files
testing
1 parent a10e8c0 commit 3c513bc

4 files changed

Lines changed: 31 additions & 3 deletions

File tree

buildnumber.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2060
1+
2069

source/funkin/game/Strum.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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;

source/funkin/system/Main.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

source/funkin/utils/MemoryUtil.hx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import neko.vm.Gc;
1212
import openfl.system.System;
1313

1414
class 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
}

0 commit comments

Comments
 (0)