it seems that the following code causes leaks with the MidiEventHolder class:
for( int j = 0; j < mf.getNumTracks(); ++j ) {
const MidiMessageSequence& mms = *(mf.getTrack(j));
for( int k = 0; k < mms.getNumEvents(); ++k ) {
if( !mms.getEventPointer(k)->message.isTempoMetaEvent() &&
!mms.getEventPointer(k)->message.isEndOfTrackMetaEvent() ) {
//do something with mms.getEventPointer(k)->message
}
}
}
in my case, I was extracting all messages from a midi file excluding the tempo and endOfTrack messages.
this doesn’t leak and accomplishes the same thing:
for( int j = 0; j < mf.getNumTracks(); ++j ) { //should be 1 track only
for( int k = 0; k < 16; k++ ) {
mf.getTrack(j)->extractMidiChannelMessages(k, extractedSequence, false);
}
}
I can’t figure out why the mms.getEventPointer()->message resulted in leaking MidiEventHolders when i shut down my application. What is the proper way to access the actual midi messages in a midi sequence?