@Override
        public void doAnAction() throws Exception {
          int valSize = ThreadLocalRandom.current().nextInt(3);
          KeyValue kv = new KeyValue(rk, cf, q, new byte[valSize]);
          int size = kv.getSerializedSize();
          ByteBufferKeyValue newCell = (ByteBufferKeyValue) mslab.copyCellInto(kv);
          totalAllocated.addAndGet(size);
          allocsByThisThread.add(new AllocRecord(newCell.getBuffer(), newCell.getOffset(), size));
        }
Test allocation from lots of threads, making sure the results don't overlap in any way
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java