JoepVanlier / JSFX

A bundle of JSFX and scripts for reaper.
MIT License
389 stars 19 forks source link

Memory usage is too high when using multiple instances of Saikes spectrum analyser (beta version) #41

Closed jc-SpaceXp closed 2 years ago

jc-SpaceXp commented 2 years ago

Basic Test

Summary

So memory usage of the spectrum analyser isn't too high. However, when loading multiple tracks with the plugin the memory usage gets excessive. Unsure if the issue is also present in the non-beta version.

Other Tests

Other things I noticed

JoepVanlier commented 2 years ago

Thanks for bringing this to my attention.

While I don't think the multi-spectral one will ever use as little as the native one (due to the extra features like being able to store reference snapshots and other stuff), I have indeed been quite aggressive in allocating memory for the plugin using lots of padding for 65536 block alignment and allocating the memory all at once for all 16 channels even when a subset is used. I've been doing some work in reducing this.

Since the code for this plugin is quite a mess (it started out as a quick and dirty hack to get a few extra features in and just grew), I had to do fairly invasive changes in how things are handled. While I did test my changes at least somewhat, this makes it difficult to guarantee that there were no bad side effects of the overhaul of how memory is handled, so I will be using the more memory efficient spectral analyzer myself for a while before merging it back to master. But if you to wish help test it and find bugs / quirks, I'd be much obliged.

You can find the new version on the following branch: https://github.com/JoepVanlier/JSFX/tree/less_mem_spectral If you want a quick overview of what changed, you could have a look at this draft PR: https://github.com/JoepVanlier/JSFX/pull/42

The files you would need to overwrite are the JSFX itself: https://raw.githubusercontent.com/JoepVanlier/JSFX/less_mem_spectral/SpectrumAnalyzer/SaikeMultiSpectralAnalyzer.jsfx

But also LoadSpectrum (it was also always setting up 16 tracks): https://raw.githubusercontent.com/JoepVanlier/JSFX/less_mem_spectral/SpectrumAnalyzer/LoadSpectrum.lua

Please let me know if this at least reduces the memory use on your system somewhat.

JoepVanlier commented 2 years ago

The PR was merged and it's in a release now. Hopefully this mostly resolves the issue for you.

jc-SpaceXp commented 2 years ago

Thanks for the quick responses and changes! Looking forward to trying it out :)