Closed
Description
In lots of different places in PyOP2 and Firedrake we have global caches implemented something like:
class MyObject:
_cache = {}
For long running simulations (e.g. CI) this results in a slow leaking of memory as this global cache gets larger and larger. Thetis for example needs to purge the cache at every test to avoid running out of memory.
It would be nice to have some sort of global pyop2.caching.cache_manager
object to hide this. This would mean class-level caches would be implemented something like:
class MyObject:
_cache = cache_manager.register("MyObject")
then later on in the simulation all (or some) of these caches can be cleaned using cache_manager.clear()
.