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

Driver::Memory high memory consuption #32

Open
skierkapl opened this issue Jan 19, 2021 · 0 comments
Open

Driver::Memory high memory consuption #32

skierkapl opened this issue Jan 19, 2021 · 0 comments

Comments

@skierkapl
Copy link

skierkapl commented Jan 19, 2021

Driver::Memory is tracking usage of keys to fulfill LRU discard policy.
However ->get() method track last used time even for keys that are not known.
Therefore memory consumption for each "missed" hit will grow and is never released.

IMHO LRU policy is applicable (access should be traced) only for keys which are in cache.

Sample code to demonstrate:
#!/usr/bin/perl
use CHI;
my $_cache = CHI->new( driver => 'Memory', max_size => 1024, global => 1);
for (0 .. 100_000_00){
my $key = rand(10000000);
$_cache->get ( $key ); # memory consumption will hit a sky
}

Pull request:
#33

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

No branches or pull requests

1 participant