Uploaded image for project: 'Apache DirectMemory'
  1. Apache DirectMemory
  2. DIRECTMEMORY-101

JVM never exit even the main thread finished

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.2
    • None
    • core
    • None

    Description

      I wrote some microbenchmark code , which just simply put 10 millions of <key,value> in to directorymemory. and found that JVM never exit even the main thread finished running.

      public class Benchmark
      {
          
          private static long ITER = 1000000000L;
      
          public static double testHeap()
          {
              CacheService<Long, String> cacheService = new DirectMemory<Long, String>()
                              .setNumberOfBuffers( 100 )
                              .setSize( 10000 )
                              .setInitialCapacity( 100000 )
                              .setConcurrencyLevel( 1 )
                              .setSerializer( new MessagePackSerializer() )
                              .newCacheService();
              
              final String str = "helloworld";
      
              // warm up
              for(long l = 0; l < ITER; l++) {
                  cacheService.put(l, str);
              }
              cacheService.clear();
              long start = System.currentTimeMillis();
              for(long l = 0; l < ITER; l++) {
                  cacheService.put(l, str);
              }
              return ((double)  ITER / (System.currentTimeMillis() - start )) * 1000;
          }
          
      
          public static void main( String[] args )
          {
              ITER = Long.parseLong( args[0] );
              System.gc();
              System.out.println("testHeap: ops=" + testHeap());
          }
      
      }
      
      

      Attachments

        1. DIRECTMEMORY-101.diff
          0.6 kB
          Min Zhou

        Activity

          People

            raffaeleguidi Raffaele P. Guidi
            coderplay Min Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: