I'm working on a multithreaded plugin. When I do a free() on quite large blocks of memory ( > 10 MB ) the application with my plugin temporarily slows down too much. ( Its an audio app, the audio thread gets too less time ). I'm not sure if the free() is using a lot of CPU or that it is blocking other threads way too long. Its seems that a call to madvice() is doing a lot of work. I'm used to free() taking up not much time ( it does not when I run in 32 bits mode ).
some info: OSX 10.8 64 bits plugin & program C++
Any suggestions on how to continue are very welcome.
One obvious suggestion would of course be to stop doing the free()
(which should be some form of delete
in C++, by the way).
Don't free the memory as long as your plugin is still loaded and active (or maybe "running"), free the resources when the plugin no longer needs to be around.
If you need to re-allocate a new buffer after freeing the old, figure out a way to re-use the already allocated memory, instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With