michaeltyson / TPCircularBuffer

A simple, fast circular buffer implementation
http://atastypixel.com/blog/a-simple-fast-circular-buffer-implementation-for-audio-processing/
839 stars 141 forks source link

Fixed memory leak #2

Closed signalsandstuff closed 12 years ago

signalsandstuff commented 12 years ago

By using mach_make_memory_entry, allocated memory was still being retained after vm_deallocate, never allowing any TPCircularBuffer to free memory.

This pull request switches it to the simpler vm_remap and fixes the leak. Also adds retrying to address the potential race condition that could lead to non-contiguous allocation.

If you're curious, the original bug can be seen in this example project: http://dl.dropbox.com/u/19471040/AllocTest.zip

michaeltyson commented 12 years ago

Thanks heaps! Great work.