Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global cache manager to facilitate cleaning memory #693

Closed
connorjward opened this issue Mar 21, 2023 · 1 comment
Closed

Add global cache manager to facilitate cleaning memory #693

connorjward opened this issue Mar 21, 2023 · 1 comment

Comments

@connorjward
Copy link
Collaborator

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().

@connorjward
Copy link
Collaborator Author

Closing as this is sorted in #724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant