Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SameeraB

macrumors newbie
Original poster
Nov 18, 2008
9
0
Hello Everyone,

I am stuck from past 3 days for fixing the memory leaks.

I have modified the SpeakHere application only for playing a (mp3) song. When i did launch this application using the Instrument I observed the memory leaks when the playing starts and playing stops.
I have added following in setUpAudioQueueBuffer() to support .mp3 playback.

bool isFormatVBR=(self.audioFormat.mBytesPerPacket == 0 || self.audioFormat.mFramesPerPacket == 0);
if(isFormatVBR)
{
packetDescriptions = (AudioStreamPacketDescription*)malloc(numPacketsToRead * sizeof(AudioStreamPacketDescription));
}
else
{
packetDescriptions=NULL;
}
I have freed packetDescriptions in dealloc() of AudioPlayer.m.
I have also freed audioLevel in AudioQueObject's dealloc.

But still I observed memory leaks. :( It is showing the memory leak in playbackCallback() as GeneralBolck-1024, generalblock-208 etc.

Any help regarding this problem is highly appreciable.

Thanks
Sameera
 

walty

macrumors member
Jul 15, 2008
33
0
Hm.. have u checked to confirm the dealloc is really called? As dealloc is to be called only when the reference count becomes zero.
 

SameeraB

macrumors newbie
Original poster
Nov 18, 2008
9
0
Hi,

Thanks for the reply.

Yeah.. dealloc() is getting called.
I have also added following in dealloc()
AudioQueueRemovePropertyListener([self queueObject], kAudioQueueProperty_IsRunning, propertyListenerCallback, self);

int bufferIndex = 0;
for (bufferIndex = 0; bufferIndex < kNumberAudioDataBuffers; ++bufferIndex)
{

AudioQueueFreeBuffer ( [self queueObject], buffers[bufferIndex]);
}


But still i get the memory leaks..
What am I doing wrong?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.