Memory leak with Engine.loadAudioFilesIntoPool
-
Hey folks, I have a handful of IRs linked to a ComboBox, and I'm using:
const irs = Engine.loadAudioFilesIntoPool();
It works fine, however in the DAW if you stop the playhead and restart the track, or close the plugin window (with plugin still running) and reopen it, it seems to load those audio files, which are already loaded, thus doubling the amount of RAM in use by those files. Over time, this becomes a huge memory issue, and projects become unusable. It's saved in the plugin state, so closing and reopening the DAW doesn't solve the issue, assuming you are running the same project file.
Issue persists in Cubase, Reaper, and FL Studio.
I couldn't find a solution for this, but I thought something like
Engine.purgeAudioFilesFromPool();
above it might do the trick, so it purges before loading.Unfortunately no such thing seems to exist.
Does anyone have a potential fix, or alternative for this? Thanks in advance.
-
@Elezeid said in Memory leak with Engine.loadAudioFilesIntoPool:
const irs = Engine.loadAudioFilesIntoPool();
You're calling this in
on init
? -
Yes. Is there a better way?
-
@Elezeid Nope, that's correct.
-
@d-healey Dang, I thought there was gonna be an alternative
Thanks anyway. I'll check back periodically hoping that someone has a solution or workaround.
-
@Elezeid Are you 100% sure it's caused by that function call?
-
@Elezeid said in Memory leak with Engine.loadAudioFilesIntoPool:
Engine.loadAudioFilesIntoPool();
Are you sure you aren't calling this function anywhere else in your code?
-
I would probably first check to see if changing 'save in preset' for your combobox changes anything. Depending on how you're using your combobox that might help.
I would probably next, check on anything calling .changed(); on your combobox....
ie; if you have a rogue 'next/previous' button calling .changed(); at the wrong time.
def sounds like you have a weird loop somewhere.
@dannytaurus said in Memory leak with Engine.loadAudioFilesIntoPool:
Are you sure you aren't calling this function anywhere else in your code?
Engine.loadAudioFilesIntoPool();and this
-
@d-healey Yes. When this line is commented out, the issue is gone.
@dannytaurus Yes. I used ctrl+F to make sure.
@Chazrox there aren't any other functions like that tied to the combo box, the script is copied line for line from one of David Healey's tutorials. It's possible that it's become outdated?
I'll try unchecking "save in preset" but it's sort of an integral component of my presets, so if that does fix it, then I'll be in some trouble haha.
-
@Elezeid said in Memory leak with Engine.loadAudioFilesIntoPool:
I used ctrl+F to make sure.
That only searches the current view, did you check all scripts in your project and all callbacks? There is a Find All Occurrences tool (ctrl + shift + f) that might help. However I doubt this is the issue since you say commenting out that line solves it.