[ scummvm-Patches-3194044 ] TOON: Cache recently used resources, rather than preloading

SourceForge.net noreply at sourceforge.net
Sun Feb 27 13:25:03 CET 2011


Patches item #3194044, was opened at 2011-02-27 13:25
Message generated for change (Tracker Item Submitted) made by eriktorbjorn
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=3194044&group_id=37116

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Torbjörn Andersson (eriktorbjorn)
Assigned to: Nobody/Anonymous (nobody)
Summary: TOON: Cache recently used resources, rather than preloading

Initial Comment:
Some time ago, I mentioned to SylvainTV that the Toonstruck engine uses a lot of memory for preloading entire PAK files, DREW.PAK probably being the worst offender since it's 20 MB that remains in memory for the duration of the game. This patch is an attempt at keeping the memory usage down by caching resources as they are used. I haven't tested it much, but it seems to work for me.

It's built on the assumption that Resources::getFileData() is for short-lived data (typically read from file and immediately copied to another data structure), so it doesn't matter if the actual data is removed from the cache, while Resources::openFile() is for long-lived data which the engine itself is responsible for handling so it doesn't go through the cache at all.

I'm sure there's room for improvements, but at least this demonstrates that the concept could work.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=3194044&group_id=37116




More information about the Scummvm-tracker mailing list