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: Doug Wyatt <email@hidden>
- Date: Mon, 28 Aug 2006 09:55:39 -0700
The MIDISysexSendRequest's data member is advanced as the data is sent.
You'll need to store the malloc'd pointer separately and free *that*
from the completion routine.
Doug
On Aug 24, 2006, at 09:40 , Kurt Revis wrote:
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.
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
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