change bam cache size via config file?


I’d like to change the size of the .bam cache for 3d models. (I’d like to make it larger.) Is there a way to do that via some configuration file, and if so, how?


Are you referring to the size of the cache on disk, or the in-memory cache?

The on-disk cache is limited by the following configuration variable, which has a quite generous default setting of 10 GiB:

model-cache-max-kbytes 10485760

Thanks for the quick reply, really appreciated.

I guess I have some foIlow-up questions;

  1. I was talking about the on-disk cache. Is that variable settable in config.prc? It doesn’t seem to be mentioned in my current config.prc file.

  2. As it stands, it seems looks like my cache is getting limited more at like 1.7Gb. THat is, as I load new egg files, .bam files are being deleted from the cache whenever it threatens to get much above 1.7Gb. It’s not going to up nearly 10Gb. I haven’t changed this variable ever, so I assume it’s at a default setting. Might there be something else that’s causing the cahce to be capped at this smaller size?

  3. [Related question:] Independently of the question about the on-disk cache, does the in-memory cache correctly interact with Linux memory cache? I’d like to run a process that will sequentially load a large number of models. I don’t want the in-memory cache to keep growing past the size of the memory of the machine, causing the process to crash. Will this automatically be handled correctly?


Just add it in Config.prc and raise the value from the default. I’d be curious if the limit does appear to be raised if you double the value.

Panda3D should (in theory) automatically clean up the model pool (ie. in-memory cache) whenever it threatens to run out of memory, but I’m unsure of the precise mechanics of that. You can also periodically call ModelPool.garbageCollect() to clear out unused models.