Akrib

Villager
Member
Joined
Jan 28, 2014
Messages
20
Reaction score
0
Primarily Uses
Hello everyone,

I searched a lot, but it seems like this has never really been adressed properly: Is there a script-call or a plugin to unload specific images from the image-cache?

This should be an important question for a lot of parallax mappers. I know that there is the automatic garbage collection which removes unused images after a time, but what about images used by parallax plugins that are not handled by the standard rpgmaker-methods? Are the images removed after each map change? Or are they even ever removed? Is this dependent on the plugin? Is there anybody who tested this with specific available plugins? Is it likely to encounter problems with memory leaks when using parallaxes for maps in rpgmmv?

Thanks in advance!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,740
First Language
English
Primarily Uses
RMMV
I don't actually think there IS any emptying of the image cache during the game.

There is an ImageManager.clear() function, which clears the entire image cache, but it is not called from anywhere. And there is no function to remove individual images.

So once it's loaded, it stays loaded, and the cache just builds and builds until you exit completely.
 

Akrib

Villager
Member
Joined
Jan 28, 2014
Messages
20
Reaction score
0
Primarily Uses
Hm, am I missing something here? If the cache is never ever cleared, then what exactly does the garbage collection do?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,763
Reaction score
8,975
First Language
German
Primarily Uses
RMMV
The garbage collection does clear the image cache, but it works independently (which is why the clear function isn't used).

I think the only way to achieve what you want is to write a new plugin that replaces the original handling of the image cache and include its own preloaders for images. That preloader needs to give you the reference to the specific image loaded so that you can clear it manually, bypassing regular garbage collection.

The base problem here is that if you allow the Browser engine to load files on demand, it can not know when which file can be cleared - that is why the garbage collection needs to work without specific. You'll need something like a preloader (even if not for its original intention) to get a reference for memory that you then can decide yourself when to clear.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,740
First Language
English
Primarily Uses
RMMV
where does the garbage collection clear the image cache? I searched for the name of the object that holds all the images, and nothing cleared any of them.
 

peq42_

Yeet
Veteran
Joined
Feb 5, 2016
Messages
528
Reaction score
315
First Language
Portuguese(BR)
Primarily Uses
RMMV
I think that GC is a thing of the chromium, browser that runs the game, projected for the web.

From what I think I know, the best you can do is "mark" things as "not being used" (by using commands like the one showed above)and wait for GC to remove it automatically once it decides to, because that system was made for better browsing, so probably it loads everything that the tab needs, and only unload after a long time or after closing the tab
 

Latest Threads

Latest Posts

Latest Profile Posts

Pretty proud of this train station i made!
unknown.png
Steam has announced a new feature to let people switch between playing on PC and on Steam Deck with the same save. I'll come back to add support for it to my steam plugins when the time comes.
Hang on, let me get my glasses...
giphy.gif
Bust Status 1!
Animated lipsynch as well as lineart. Just lineart so far...
Ramona Expression 1-2 L.gifRamona Expression 1-1 L.gifRamona Bust 1C.png
2 FPS 5 FPS Static
SF_People3_7 added!
index.php

Forum statistics

Threads
118,692
Messages
1,117,956
Members
155,819
Latest member
SCW
Top