2 Replies Latest reply on Feb 10, 2010 7:39 AM by Manik Surtani

    OutOfMemoryError running test

    Lin Ye Expert

      I am running a test - that generates 10000 entries in the cache, and randomly updating 25% of the entries for 1000 times, and gets the average time for updating. However, even with a local cache, it's getting the following exception around the 770th updates:

      Exception in thread "pool-1-thread-1" org.infinispan.CacheException: java.lang.OutOfMemoryError: Java heap space
              at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:278)
              at org.infinispan.CacheDelegate.putAll(CacheDelegate.java:432)
              at org.infinispan.CacheDelegate.putAll(CacheDelegate.java:210)
              at org.infinispan.demo.InfinispanDemo$9$1.run(InfinispanDemo.java:270)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
              at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.OutOfMemoryError: Java heap space


      I run the same code against a regular HashMap, and it works fine. So it seems something inside infinispan takes the memory. Could you please suggest what's going on?




        • 1. Re: OutOfMemoryError running test
          Galder Zamarreño Master

          Hmmm, could you attach such test? What Infinispan version are you using? Could you post the configuration? What JDK are you using? What VM parameters are you passing?


          You can do a bit of debugging yourself by adding the following VM parameters:

          -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/java_heap


          And then using something like Eclipse MAT to analyse the dump.

          1 of 1 people found this helpful
          • 2. Re: OutOfMemoryError running test
            Manik Surtani Master
            A HashMap will always have less overhead than Infinispan.  Even a CHM has much higher memory footprint due to locks.  How much mem have you allocated to the VM, how big is each key and value, and what concurrency level tuning params have you used?  Are you using striped locks?
            1 of 1 people found this helpful