@Test public void testLABLargeAllocation() { MemStoreLAB mslab = new MemStoreLAB(); Allocation alloc = mslab.allocateBytes(2*1024*1024); assertNull("2MB allocation shouldn't be satisfied by LAB.", alloc); }
public Allocation allocateBytes(int size) { Preconditions.checkArgument(size >= 0, "negative size"); if (size > maxAlloc) { return null; } while (true) { Chunk c = getOrMakeChunk(); int allocOffset = c.alloc(size); if (allocOffset != -1) { return new Allocation(c.data, allocOffset); } tryRetireChunk(c); } }
MemStoreLAB { public Allocation allocateBytes(int size) { Preconditions.checkArgument(size >= 0, "negative size"); if (size > maxAlloc) { return null; } while (true) { Chunk c = getOrMakeChunk(); int allocOffset = c.alloc(size); if (allocOffset != -1) { return new Allocation(c.data, allocOffset); } tryRetireChunk(c); } } }
MemStoreLAB { public Allocation allocateBytes(int size) { Preconditions.checkArgument(size >= 0, "negative size"); if (size > maxAlloc) { return null; } while (true) { Chunk c = getOrMakeChunk(); int allocOffset = c.alloc(size); if (allocOffset != -1) { return new Allocation(c.data, allocOffset); } tryRetireChunk(c); } } MemStoreLAB();  MemStoreLAB(Configuration conf); }
MemStoreLAB { public Allocation allocateBytes(int size) { Preconditions.checkArgument(size >= 0, "negative size"); if (size > maxAlloc) { return null; } while (true) { Chunk c = getOrMakeChunk(); int allocOffset = c.alloc(size); if (allocOffset != -1) { return new Allocation(c.data, allocOffset); } tryRetireChunk(c); } } MemStoreLAB();  MemStoreLAB(Configuration conf); Allocation allocateBytes(int size); }
MemStoreLAB { public Allocation allocateBytes(int size) { Preconditions.checkArgument(size >= 0, "negative size"); if (size > maxAlloc) { return null; } while (true) { Chunk c = getOrMakeChunk(); int allocOffset = c.alloc(size); if (allocOffset != -1) { return new Allocation(c.data, allocOffset); } tryRetireChunk(c); } } MemStoreLAB();  MemStoreLAB(Configuration conf); Allocation allocateBytes(int size);  }