Resource Manager for memory

Feedback on past, current, and future development.
User avatar
psi29a
Posts: 5362
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Resource Manager for memory

Post by psi29a »

To be fair, we are making OpenMW in such a way as to use as much modern technology and techniques as possible to help improve the look and feel of Morrowind. As a result, OpenMW will use more resources than what Morrowind ever did.

Do not assume that OpenMW will use the same or less resources than Morrowind, though that would be nice. ;)
Ranomier
Posts: 6
Joined: 16 Jun 2014, 01:35

Re: Resource Manager for memory

Post by Ranomier »

No for sure not i know that. But i had 60% and more ram usage with 4gb ram only for openmw. ^^

And it could growong further.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Resource Manager for memory

Post by Chris »

Ranomier wrote:i can try to create something, but if im looking on my ram usage, it is biiig and it gets bigger during playing.
This is a known issue, but AFAIK no one's been able to pin down what's leaking (there was apparently a VBO leak with MyGUI that was worked around not too long ago, but I don't think that's all of it). But rest assured, Ogre already does resource management like this with models and textures, and we have something similar in place for sounds.

NIF files currently use a temporary cache (IIRC they stay loaded while a cell transition occurs, but then get released when finished), but they could perhaps benefit from being turned into an Ogre Resource (so they can remain loaded between transitions, its data can be shared directly instead of copied (e.g. the keyframe/animation data), and get freed automatically when they're not needed and a memory budget/limit is reached).
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Resource Manager for memory

Post by Zini »

but they could perhaps benefit from being turned into an Ogre Resource (so they can remain loaded between transitions, its data can be shared directly instead of copied (e.g. the keyframe/animation data), and get freed automatically when they're not needed and a memory budget/limit is reached).
That sounds like a very interesting idea.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Resource Manager for memory

Post by scrawl »

The concept sounds good, but a custom implementation would be better than an Ogre resource. Ogre resource managers don't have any notion of when a resource was last accessed, so when it hits the budget limit it'll just randomly unload something that's unused, and we can't really mark NIF files as "used", when they're only ever used during cell transitions.
Last edited by scrawl on 18 Jun 2014, 22:59, edited 1 time in total.
User avatar
psi29a
Posts: 5362
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Resource Manager for memory

Post by psi29a »

scrawl wrote:The concept sounds good, but a custom implementation would be better than an Ogre resource. Ogre resource managers don't have any notion of when a resource was last accessed, so when it hits the budget limit it'll just randomly unload something that's unused, and we can't really mark NIF files as "used".
That is very ugly... I would expect some type of last-used data being used per resource, as to semi-intelligently pick things that haven't been touched in awhile. Who thought that randomly picking something was a good idea?
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Resource Manager for memory

Post by Chris »

psi29a wrote:That is very ugly... I would expect some type of last-used data being used per resource, as to semi-intelligently pick things that haven't been touched in awhile. Who thought that randomly picking something was a good idea?
It's just part of Ogre's design. Neither the resource or resource manager knows when it was used, just whether it's currently being used, so when it unloads unused resources it can't check when it was last used. It would need to set a last-used timestamp whenever decrementing a resource's refcount, so when it searches for resources with no external references it can compare timestamps and remove the ones with the earliest times. But the way resource handles are managed doesn't make that easy because the resource handle is just a typedef for SharedPtr<resource_type> -- the resource itself doesn't manage a refcount so can't set a timestamp when it changes.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Resource Manager for memory

Post by Zini »

Actually, we don't really need the last used approach, since we have a world structure that is rather rigid It would make way more sense to extrapolate which cells may become active in the near future, list all resources for these and throw out any other resources, when we are at capacity.
BlueFootedBooby
Posts: 36
Joined: 15 Sep 2013, 16:00
Location: ...here?

Re: Resource Manager for memory

Post by BlueFootedBooby »

Zini wrote:Actually, we don't really need the last used approach, since we have a world structure that is rather rigid It would make way more sense to extrapolate which cells may become active in the near future, list all resources for these and throw out any other resources, when we are at capacity.
Out of curiosity, what kind of logic do you have in mind? The cell you're in and any next to it? Maybe cells linked to by nearby doors?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Resource Manager for memory

Post by Zini »

Something like that. But also considering the distance from the cell border/the door plus maybe some other things that I have not thought of yet.
Post Reply