I previously posted this in the SDK forum but then saw that this forum exists so this may be a better place to put it...
I deal with a lot of users and a relatively large data set. I have an automated process that churns through files to do stuff, the simplest of which is one that just opens every AEP file in a directory hierarchy and saves it, so that subsequent processes (and the users themselves) don't need to deal with manually upgrading files after a version bump in After Effects.
I generate a script with a batch file and then launch AfterFX.com -m -r the_script.jsx.
After Effects leaks memory like mad. My computer gets slower and slower as this list of items is processed and I'm wondering if there's something else I should be doing to get After Effects to reset its memory usage, something a little cleaner than just app.quit()'ing after every 10 files or so. (Which I'd like to avoid because at present everything works well enough in a Windows batch file.)
Here's what I'm doing, filenames changed to protect the guilty but otherwise this is the sort of script that I run.
function Resave(filename) {
try{
var file=new File(filename);
app.open(file);
app.project.save(file);
}
catch(err) {
alert('Error while processing: ' + filename + '\n\n' + err.message);
}
app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
}
app.saveProjectOnCrash = false;
app.beginSuppressDialogs();
Resave('XXXXXXXXXXXXXXXXXXXXXX\\XXXXXXXXXXXXXXXXXXXX.aep');
Resave('XXXXXXXXXXXX\\XXXXXXXXXXXX.aep');
Resave('XXXXXXXX\\XXXXXXXX.aep');
Resave('XXXXXXXXXXXX\\XXXXXXXXXXX.aep');
// 100+ more lines of this
Resave('XXX\\XXX.aep');
app.endSuppressDialogs(false);
app.quit();