Possible Sound Manager memory leak
Possible Sound Manager memory leak
- Subject: Possible Sound Manager memory leak
- From: EJ Campbell <email@hidden>
- Date: Sat, 31 Aug 2002 16:59:14 -0700
I believe the following code snippet exposes a memory leak in Mac OS
X's Sound Manager API. As it runs, the process will *slowly* consume
more and more memory. The same leak occurs both on 10.1 and 10.2.
#include <iostream>
#include <Carbon/Carbon.h>
int main (int argc, const char * argv[]) {
std::cout << "Iterating 1,000,000 times. Examine memory usage using
top...\n";
for(long i = 0; i < 1000000; i++)
{
long writeRef;
short on = 1;
SPBOpenDevice("\p",siWritePermission,&writeRef);
SPBSetDeviceInfo (writeRef, siContinuous, (Ptr) &on);
SPBCloseDevice(writeRef);
}
std::cout << "Iteration finished\n";
return 0;
}
Running leaks on the process shows several leaks here:
Call stack: [thread ffffffff]: | 0x0 | start | _start | main |
SPBOpenDevice | OpenSinp | SinpMgr::OpenSinp(unsigned char const*,
ComponentInstanceRecord*&) const | OpenAComponent | CallComponentOpen |
HALInputComponentDispatch | HALInputOpen | InitializeHALInput |
InitializeBuffers | NewPtr | malloc_zone_malloc
Is this a legitimate memory leak, and if so, is it already known?
Thanks,
EJ
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.