Skip to content

Commit dee2627

Browse files
committed
Trim LRU maps after dropping entries
1 parent d8e9377 commit dee2627

File tree

1 file changed

+2
-0
lines changed
  • common/src/main/java/org/embeddedt/modernfix/util

1 file changed

+2
-0
lines changed

common/src/main/java/org/embeddedt/modernfix/util/LRUMap.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public void setPermanentEntries(Set<K> permanentEntries) {
2828
}
2929

3030
public void dropEntriesToMeetSize(int size) {
31+
int expectedQuota = size;
3132
// Increase allowed size quota to include permanent entries
3233
size += permanentEntries.size();
3334
int prevSize = size();
@@ -39,6 +40,7 @@ public void dropEntriesToMeetSize(int size) {
3940
iterator.remove();
4041
}
4142
}
43+
trim(size() + expectedQuota);
4244
if(ModernFixPlatformHooks.INSTANCE.isDevEnv()) {
4345
ModernFix.LOGGER.warn("Trimmed map from {} to {} entries", prevSize, size);
4446
}

0 commit comments

Comments
 (0)