I'm having a problem with MV filling up the memory of iOS hardware after showing a series of images and playing sounds.
Is there any JS command to force it to clear assets out of the memory that are no longer needed?
No, that's the garbage collector's job, which runs periodically and destroys objects no longer referenced. Are you using plugins? I'm assuming you do, because a base RPG Maker game is rather uhhh... generic. Anyway, it's possible that your plugins are designed badly. If a lot of data is referenced by a plugin, but never used, the Garbage Collector can not release the memory, because something is still holding it, and the garbage collector does not know if it will be used, so it does not touch it. This is how memory leaks happen.
These issues are very easy to come by in very large plugin systems, such as complex menus, battle systems, anything that works with Audio or Images (especially as these always take up a relative lot of memory to use). You should check to make sure your plugins were well-designed.
Additionally, these memory leaks aren't going to just show up on iOS and nowhere else. You can run the game on your desktop/laptop/whatever, and use the debugging tools included with NWJS (chrome) to try to find the source of the memory leaks. That should help you narrow down where all your memory is going.
Oh, I thought we were talking about building for Android, which is where I had seen Chrome used in the past. My mistake.
At this point, I know exactly where my memory is going: it's being used by images.
What I don't know is if there's any way to force MV to clear the image cache on command...
I don't really suggest clearing the cache every now and then since that would mean that most images that you're constantly using will then have to be frequently loaded back from their files which will bring a lot of "load time" to your game, esp if these images are large. You might end up freeing memory for a while but then end up having a laggy game due to the constant reloading of resources.
It would be better to make sure than none of those images won't be used soon, and make sure any unneeded images are not referenced so that the GC can remove them. If it still takes up a lot of memory with just the actual images that are constantly being used, I think it's time to think about optimizing the images or using less of them because if your game is already optimized (no unused images saved in cache etc) and it still uses a lot of memory, clearing the cache often will surely result to the load issues.
Anyway if you really want to do it, I think this is the function
ImageManager.clear()
It might not delete them directly, but at least it unloads everything that the cache holds so hopefully the GC will then remove those from the memory since they aren't referenced anymore.
I don't think the game saves sounds in a cache or something.. at the very least Ace doesn't seem to do it (coz I've had problems playing a sound then trying to delete it while it's playing, windows tells me it cannot delete the file coz it's still in use) not sure with MV.