MV Clear "Image Memory" cache

Hi RM community!

So I've been looking everywhere for a way to clear the "Image Memory" cache (so that images can be cleared from the memory once you're done using them) and I had found no answer. The answer came from a dev who knows more than me, but I'll leave him unnamed because I don't know if they want to be named xD

So I'm writing this thread just to share what I found:

Clear Image Memory cache:
ImageManager.clear();

This will require to reload images as if you closed and reopened the game.
As far as I've found, loading images to the cache is easily done by Galv Image Cache plugin. It had some problems for me, but entering and editting a bit of his code solved them easily. (basically, "let i in array" doesn't work as intended for me for some reason). This plugin also provides a script call to load an image into the cache before showing it, so it's really really helpful.

ALTERNATIVELY: What I've found is that you can
fadeout
->show image1->wait 1 frame
->show image2->wait 1 frame
->remove image1->remove image2
->fadein

This will also load them in.

So yeah, I hope this is helpful. Have fun eventing!

PS: By the way, if you're using pixi stuff, you can also use this:
Clear Pixi cache:
PIXI.utils.TextureCache = {};
upon leaving area, queue for preload.
upon entering area, from memory, collect file names.
with file names, subtract preload array, keep names to remove.
unload names to remove from memory.
perform GC.
with preload array, if file present, skip; if not, load.
clear file names.
clear preload array.

that's my preloader, in broad strokes.
YOU ARE A FREAKING LIFE SAVER!!!

Original thread: https://forums.rpgmakerweb.com/threads/clear-image-memory-cache.133693/