code: public synchronized int allocateNextChunk() {
          if ((used_bytes.longValue() + (long) mem_chunksize) > max_allowed_bytes) {
              logger.info("No memory left");
              return 0;
          }
          used_bytes.set(used_bytes.longValue() + (long) mem_chunksize);
          return mem_chunksize;
      }
docs: This method tries to mark memory as allocated. It allocates as much bytes as defined in <code>MEMORY_CHUNK</code>
  and returns the number of bytes marked as allocated. This method doesn't really allocate memory.
  
  @return the size of the allocated chunk