Skip to content

Add cache management for _schwarz_screener_cache (unbounded memory growth) #247

@San1357

Description

@San1357

Problem

_schwarz_screener_cache in gbasis/integrals/electron_repulsion.py is a
global dictionary with no eviction policy. During long sessions with different
basis sets and thresholds, it can keep accumulating entries leading to
unbounded memory growth.

Proposed Fix

One potential approach could be using weakref.WeakValueDictionary so cache
entries are automatically evicted when basis set objects are garbage collected.
Other options like LRU cache or a manual clear_cache() function could also
be considered — open to suggestions.

Related

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions