Open falsetto opened 12 years ago
I'm having the same issue here... I'm making a MIDI remote controller so the MIDI data is traveling at a very high rate. The memory is leaking at about 0.3MB/min, and the App would crash after certain amount of time (1 hour maybe, on the 1st gen iPad, if running heavily). I googled a little and someone claims that CoreMIDI API is leaking memory. Would you please confirm that?
Thanks again for releasing PGMidi, it rocks anyway!!
Update, if PGMidi is compiled with no ARC (-fno-objc-arc), it will be fine.
I changed the midiRead: function in PGMidi.mm to this:
(void) midiRead:(const MIDIPacketList )pktlist { NSAutoreleasePool pool = [[NSAutoreleasePool alloc] init]; [delegate midiSource:self midiReceived:pktlist]; [pool drain]; }
and disabled ARC (-fno-objc-arc) for PGMidi.mm, and now it works.
Overview
There appears to be a memory leak in the example app code or the PGMidi library. I'm trying to port the example code to RubyMotion and the app is crashing when running on the device with 'EXC_CRASH (SIGABRT)' shown as the reason in the device log. According to SO, that crash code indicates a memory leak?
I'm brand new to iOS app development and unfortunately have no idea how to fix the issue. But I'm nervous to keep banging my head against the wall trying to get the example app ported to RubyMotion knowing that there's a possible bug. I'm not sure how severe the issue is or if it could be causing the EXC_CRASH crashes. Since I can't fix the issue, I've tried to do as much of the debugging footwork as possible for you.
Thanks so much for taking a look and for releasing PGMidi. I sure appreciate it!
Debug Panel Output
I was able to hook up a wireless MIDI device to the simulator so I could reproduce the bug in a better debugging environment. Here is the output in the debugging panel when choosing 'Product -> Run':
Instruments Leak Backtrace
I also was able to get a backtrace on the leak by running the app with Instruments. Here is the leak backtrace:
Steps to reproduce