How works image cache & preloading?

Hi!
I need an info about how the image cache system works in RPG MV.
I use animated characters busts and I use pictures as frames to animate them.
I also use a plugin to preload images in order to avoid flickering.
I organized things like this:
1) Preload every image through scripts
2) Show picture commands to create animation
3) I run the ImageManager.clear() script to unload cache every 4-5 animations cycles
What happen if the game tries to preload same images (i.e. the same animation) before the cache is cleared by the script?
Will the game preload two copies of the same file in the cache? Will the "new" file overwrite the old one? Or won't it be preloaded again at all because it is already there?
It can help me to better calibrate when and how often to clear the cache
The default cache size limit is 10 MPix; if your project needs to keep a lot of images in memory then consider using a plugin like Community_Basic.js (in new projects by default) to increase that limit.

I wrote a post explaining the technical side of things here:
JavaScript's garbage collection clears data from memory when no more references exist to that data:
RMMV's image cache simply keeps recent images "alive" by storing a reference to their data. If the game tries to load an image, it checks the cache first:
  • If it finds a reference to the requested image, it can simply return that reference rather than loading the data again from file.

  • If it doesn't find a reference, the data is loaded from file into a new, appropriately-labelled cache entry. If this takes the cache size over the limit then cache entries are deleted, starting with the last-referenced ("oldest"), until the size is below the limit again.
The limit exists to keep the game's RAM consumption at or below a known value. For example, you don't want some intro cutscene images occupying RAM until the end of the play session! This is particularly relevant for image-heavy games on devices with relatively low RAM (e.g. mobile).

Remember that image data in RAM will be raw/bitmap format, which may be several times larger than the size of the corresponding PNG file.
Oh, thank you for your post!
Yeah, I already use Community_Basic.js to increase the cache size limit, but still I asked cuz I was curious and I didn't want to increase the limit to unnecessary values🙏

Original thread: https://forums.rpgmakerweb.com/threads/how-works-image-cache-preloading.143669/