You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Hex007!
I think calling MidiSequencer.close() when deallocating a player which is an instance of a MIDI player can help prevent memory leak. (There is a particular game that re-creates a MIDI player every time when the character enters a new scene, so after entering 100 scenes or so the program starts to consume ~600 MB of memory and have ~200 running threads.)
On Linux, having more than a few MIDI players will cause the music to stop, but this doesn't happen on Windows.
The fix may look like the following:
public void deallocate() {
stop();
if (player instanceof midiPlayer) {
((midiPlayer)player).midi.close();
}
player = null;
state = Player.CLOSED;
}
freej2me/src/org/recompile/mobile/PlatformPlayer.java
Line 142 in f3b6f05
Hello Hex007!
I think calling
MidiSequencer.close()
when deallocating a player which is an instance of a MIDI player can help prevent memory leak. (There is a particular game that re-creates a MIDI player every time when the character enters a new scene, so after entering 100 scenes or so the program starts to consume ~600 MB of memory and have ~200 running threads.)On Linux, having more than a few MIDI players will cause the music to stop, but this doesn't happen on Windows.
The fix may look like the following:
Thanks!
p.s. A similar issue and the usage of
close()
is mentioned in this Stackoverflow post: Java Sequencer using all memory? (7kb midi file)The text was updated successfully, but these errors were encountered: