Cast manager now caches based on memory usage of the cached action frame
images, except that this is all fucked because the action frames get generated on the fly which means that we'd need to update the LRU cache with info on our new size which would hugely complicated things, so instead we're going to rework the whole business in the future to cache individually composited images rather than the whole goddamned action frame kit and kaboodle. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2172 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: CharacterManager.java,v 1.31 2003/01/15 02:36:59 mdb Exp $
|
// $Id: CharacterManager.java,v 1.32 2003/01/17 02:28:32 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.cast;
|
package com.threerings.cast;
|
||||||
|
|
||||||
@@ -45,8 +45,12 @@ public class CharacterManager
|
|||||||
|
|
||||||
// create our in-memory action cache
|
// create our in-memory action cache
|
||||||
int acsize = _cacheSize.getValue();
|
int acsize = _cacheSize.getValue();
|
||||||
Log.debug("Creating action cache [size=" + acsize + "].");
|
Log.debug("Creating action cache [size=" + acsize + "k].");
|
||||||
_frames = new LRUHashMap(acsize);
|
_frames = new LRUHashMap(acsize*1024, new LRUHashMap.ItemSizer() {
|
||||||
|
public int computeSize (Object value) {
|
||||||
|
return (int)((ActionFrames)value).getEstimatedMemoryUsage();
|
||||||
|
}
|
||||||
|
});
|
||||||
_frames.setTracking(true); // TODO
|
_frames.setTracking(true); // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +285,7 @@ public class CharacterManager
|
|||||||
* framework. */
|
* framework. */
|
||||||
protected static RuntimeAdjust.IntAdjust _cacheSize =
|
protected static RuntimeAdjust.IntAdjust _cacheSize =
|
||||||
new RuntimeAdjust.IntAdjust(
|
new RuntimeAdjust.IntAdjust(
|
||||||
"Size (in actions) of the character manager LRU action " +
|
"Size (in kb of memory used) of the character manager LRU " +
|
||||||
"cache [requires reboot]", "narya.cast.action_cache_size",
|
"action cache [requires restart]", "narya.cast.action_cache_size",
|
||||||
CastPrefs.config, 30);
|
CastPrefs.config, 2*1024);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: CompositedActionFrames.java,v 1.13 2003/01/13 23:53:04 mdb Exp $
|
// $Id: CompositedActionFrames.java,v 1.14 2003/01/17 02:28:32 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.cast;
|
package com.threerings.cast;
|
||||||
|
|
||||||
@@ -146,8 +146,7 @@ public class CompositedActionFrames
|
|||||||
if (mirage == null) {
|
if (mirage == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// TODO: do the right thing here
|
size += mirage.getEstimatedMemoryUsage();
|
||||||
size += (mirage.getWidth() * mirage.getHeight() * 4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
|
|||||||
Reference in New Issue
Block a user