I wanted to purge memory and disk via script. I used this code:
app.purge(PurgeTarget.ALL_CACHES);
app.purge(PurgeTarget.UNDO_CACHES);
app.purge(PurgeTarget.SNAPSHOT_CACHES);
app.purge(PurgeTarget.IMAGE_CACHES);
To my surprise this didn't clear the cache. I deduced that from going to Edit->Purge->All Memory and Disk Cache where I was greeted with the message that a couple of GB will be cleared if I proceed.
On the other side, there was a bug in AE that caused AE crash on every second render of the same exact project. Running the code above resolved the issue.
So what does app.purge() really do?