public static void main5(String[] args) throws Exception {
    DistributedSystem system = DistributedSystem.connect(new java.util.Properties());
    Cache cache = CacheFactory.create(system);
    AttributesFactory factory = new AttributesFactory();
    factory.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(2,
        null, EvictionAction.OVERFLOW_TO_DISK));
    LocalRegion region = (LocalRegion) cache.createRegion("TestDiskRegion", factory.create());
    // DiskRegion dr = region.getDiskRegion();
    // DiskRegionStats diskStats = dr.getStats();
    EvictionCounters lruStats = getLRUStats(region);

    for (int i = 0; i < 10000; i++) {
      int[] array = new int[1000];
      array[0] = i;
      try {
        region.put(array, i);

      } catch (IllegalStateException ex) {
        System.out.println("Ran out of space: " + ex);
        return;
      }
    }

    String s = "Limit is " + lruStats.getLimit() + " evictions are " + lruStats.getEvictions();
    throw new RuntimeException(s);
  }
Filling up the region with keys and values
geode-core/src/test/java/org/apache/geode/cache30/TestDiskRegion.java