1 Reply Latest reply on Aug 4, 2016 10:15 AM by william.burns

    Infinispan 8.0.1Final - LIRS eviction issue


      Following code:

      Configuration c = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LIRS)



        DefaultCacheManager manager = new DefaultCacheManager(c);


        Cache<Object, Object> testCache = manager.getCache("test");

         for (int i=0; i < 10000000; i ++)


         for (int j=0; j < 100; j++)


        testCache.put(""+ i+j,""+i+j);






      Works as following:

      1. Size is really  limited by 100 as expected

      2. Objects

      org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8$LIRSNode1916185619,161,856 (7.5%)598,808 (10.1%)
      org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8$LIRSNode[]747792747,792 (0.3%)31,158 (0.5%)

      has not being evicted from heap and keep growing


      it starts cleaning those objects only after  access was added for every element:

        Object o = testCache.get("" + i + j);

      Only after those object has cleaned

      It looks like MemoryLeak or i'm missing something?

        • 1. Re: Infinispan 8.0.1Final - LIRS eviction issue

          Unfortunately what you are seeing is how LIRS is designed to work.  It keeps what it calls a non resident block for entries that were removed due to changing from a HIR resident (in cache) to a HIR non resident (not in cache, but has placeholder).  Those objects you are seeing are placeholders stored so that if that object is referenced again it can be promoted to LIR due to being referenced again.  If you look at LIRS caching algorithm - Wikipedia, the free encyclopedia the (a) state is the starting state.  The b, c, d, and e states are each one step from a.  In this case you have the e state, where each insertion is removing a previous entry from stack Q and then making that entry a non resident.  By having an access you are reordering the stack S and allowing us to remove old reference blocks.