code: private synchronized void freeIndexInformation() {
      while (totalMemoryUsed.get() > totalMemoryAllowed) {
        String s = queue.remove();
        IndexInformation info = cache.remove(s);
        if (info != null) {
          totalMemoryUsed.addAndGet(-info.getSize());
        }
      }
    }
docs: Bring memory usage below totalMemoryAllowed.