Re: How to release memory allocated for MIDISendSysex ??
Re: How to release memory allocated for MIDISendSysex ??
- Subject: Re: How to release memory allocated for MIDISendSysex ??
- From: Kurt Revis <email@hidden>
- Date: Thu, 24 Aug 2006 09:40:47 -0700
On Aug 24, 2006, at 7:09 AM, Marco Hinic wrote:
Our new application does use a lot of sysex messages.
We are using MIDISendSysex function and the associated
MIDISysexSendRequest structure to do so.
For each message, a new data buffer is allocated with malloc and we
also
ceate a new MIDISysexSendRequest structure.
Can we simply free the message data and delete MIDISysexSendRequest in
the MIDICompletionProc ?
That's exactly what you should do.
Deleting the MidiSysexSendRequest does not seems to cause any trouble
but free'ing it's data leads to a message from the malloc that we are
freeing a block that was not allocated by malloc or free'd twice.
Is the
free of the data automatic ? We removed the free but are afraid
there's
going to be memory leaks in some parts.
CoreMIDI will NOT automatically free the data. (It has no way of
knowing that you originally used malloc() to allocate the buffer, so
it cannot safely call free() on it.) Your code must be doing it, one
way or another. Or maybe you're trashing the data pointer before you
call free() on it.
--
Kurt Revis
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden