Re: iTunes stuttering, and don't shoot me--it might involve Core Audio
Re: iTunes stuttering, and don't shoot me--it might involve Core Audio
- Subject: Re: iTunes stuttering, and don't shoot me--it might involve Core Audio
- From: Take Vos <email@hidden>
- Date: Tue, 9 Aug 2005 21:22:21 +0200
Hi,
> It does raise a question I have been meaning to ask: Is there
some way to
> hint to the OS that in the near future, a particular page of
memory is going
> to be needed so the VM engine could have it ready in physical ram
for the
> next core-audio render cycle?
Yes there is.
First use valloc() function to allocate page aligned memory.
Then use mlock() function to lock this memory, this memory will not
be swapped out, also this function guaranties that all pages actually
point to physical memory.
Use munlock() to unlock this memory and free() to free the memory.
I use this for the ring buffer of my audio recording application,
also at the end of the io cycle after you've written into the ring
buffer, one should call OSMemoryBarrier() to flush the cpu cache to
the ring buffer. This so that the thread that reads from the ring
buffer will actually get data on multi cpu machines.
Take
_______________________________________________
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