geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
public boolean mustEvict(LRUStatistics stats, Region region, int delta) {
        final InternalCache cache = (InternalCache) region.getRegionService();
        InternalResourceManager resourceManager = cache.getInternalResourceManager();
        boolean offheap = region.getAttributes().getOffHeap();
        final boolean monitorStateIsEviction =
            resourceManager.getMemoryMonitor(offheap).getState().isEviction();
        if (region instanceof BucketRegion) {
          return monitorStateIsEviction && ((BucketRegion) region).getSizeForEviction() > 0;
        }

        return monitorStateIsEviction && ((LocalRegion) region).getRegionMap().sizeInVM() > 0;
      }
/**
       * Okay, deep breath. Instead of basing the LRU calculation on the number of entries in the
       * region or on their "size" (which turned out to be incorrectly estimated in the general
       * case), we use the amount of memory currently in use. If the amount of memory current in use
       * {@linkplain Runtime#maxMemory max memory} - {@linkplain Runtime#freeMemory free memory} is
       * greater than the overflow threshold, then we evict the LRU entry.
       */
Okay, deep breath. Instead of basing the LRU calculation on the number of entries in the
region or on their "size" (which turned out to be incorrectly estimated in the general
case), we use the amount of memory currently in use. If the amount of memory current in use
Runtime#maxMemory max memory -  Runtime#freeMemory free memory is
greater than the overflow threshold, then we evict the LRU entry.
Okay deep breath . Instead of basing the LRU calculation on the number of entries in the region or on their " size " ( which turned out to be incorrectly estimated in the general case ) we use the amount of memory currently in use . If the amount of memory current in use Runtime#maxMemory max memory - Runtime#freeMemory free memory is greater than the overflow threshold then we evict the LRU entry .
public boolean mustEvict(LRUStatistics stats, Region region, int delta) {
        final InternalCache cache = (InternalCache) region.getRegionService();
        InternalResourceManager resourceManager = cache.getInternalResourceManager();
        boolean offheap = region.getAttributes().getOffHeap();
        final boolean monitorStateIsEviction =
            resourceManager.getMemoryMonitor(offheap).getState().isEviction();
        if (region instanceof BucketRegion) {
          return monitorStateIsEviction && ((BucketRegion) region).getSizeForEviction() > 0;
        }
        return monitorStateIsEviction && ((LocalRegion) region).getRegionMap().sizeInVM() > 0;
      }
public boolean mustEvict ( LRUStatistics stats , Region region , int delta ) { final InternalCache cache = ( InternalCache ) region . getRegionService ( ) ; InternalResourceManager resourceManager = cache . getInternalResourceManager ( ) ; boolean offheap = region . getAttributes ( ) . getOffHeap ( ) ; final boolean monitorStateIsEviction = resourceManager . getMemoryMonitor ( offheap ) . getState ( ) . isEviction ( ) ; if ( region instanceof BucketRegion ) { return monitorStateIsEviction && ( ( BucketRegion ) region ) . getSizeForEviction ( ) > 0 ; } return monitorStateIsEviction && ( ( LocalRegion ) region ) . getRegionMap ( ) . sizeInVM ( ) > 0 ; }
Okay, deep breath.
Okay deep breath .