/** * Allocates a chunk and adds it to the thread's Chunk list. */ private void allocate() { int allocation = allocationSize(); Chunk chunk = (Chunk) allocator.allocate(allocation, null); // This should always work just after allocation chunk.validateFill(allocator.TINY_MULTIPLE); chunks.add(chunk); totalAllocation += chunk.getSize(); }
/** * Allocates a chunk and adds it to the thread's Chunk list. */ private void allocate() { int allocation = allocationSize(); Chunk chunk = (Chunk) allocator.allocate(allocation, null); // This should always work just after allocation chunk.validateFill(allocator.TINY_MULTIPLE); chunks.add(chunk); totalAllocation += chunk.getSize(); }
chunk.validateFill(this.allocator.TINY_MULTIPLE); } catch(IllegalStateException e) { fail(e.getMessage()); chunk.validateFill(this.allocator.TINY_MULTIPLE); } catch(IllegalStateException e) { TestCase.fail("Chunk fill validation failed: " + e.getMessage()); chunk.validateFill(this.allocator.TINY_MULTIPLE); } catch(IllegalStateException e) { TestCase.fail("Chunk fill validation failed: " + e.getMessage()); chunk.validateFill(this.allocator.TINY_MULTIPLE); } catch(IllegalStateException e) { failure = true;
chunk.validateFill(this.allocator.TINY_MULTIPLE); } catch(IllegalStateException e) { fail(e.getMessage()); chunk.validateFill(this.allocator.TINY_MULTIPLE); } catch(IllegalStateException e) { TestCase.fail("Chunk fill validation failed: " + e.getMessage()); chunk.validateFill(this.allocator.TINY_MULTIPLE); } catch(IllegalStateException e) { TestCase.fail("Chunk fill validation failed: " + e.getMessage()); chunk.validateFill(this.allocator.TINY_MULTIPLE); } catch(IllegalStateException e) { failure = true;
result.validateFill(SimpleMemoryAllocatorImpl.this.TINY_MULTIPLE);
allocatedChunks[i].validateFill(this.allocator.TINY_MULTIPLE); allocatedChunks[i].validateFill(this.allocator.TINY_MULTIPLE); slightlyLargerChunk.validateFill(this.allocator.TINY_MULTIPLE);
result.validateFill(SimpleMemoryAllocatorImpl.this.TINY_MULTIPLE);
private Chunk basicAllocate(int idx, int multiple, int offset, AtomicReferenceArray<SyncChunkStack> freeLists, boolean useFragments, ChunkType chunkType) { SyncChunkStack clq = freeLists.get(idx); if (clq != null) { long memAddr = clq.poll(); if (memAddr != 0) { Chunk result = SimpleMemoryAllocatorImpl.this.chunkFactory.newChunk(memAddr, chunkType); // Data integrity check. if(validateMemoryWithFill) { result.validateFill(SimpleMemoryAllocatorImpl.this.TINY_MULTIPLE); } result.readyForAllocation(chunkType); return result; } } if (useFragments) { return allocateFromFragments(((idx+1)*multiple)+offset, chunkType); } else { return null; } } private Chunk allocateHuge(int size, boolean useFragments, ChunkType chunkType) {