MemoryAllocation allocate(boolean clear) { if (nextIndex < allocations.length && allocations[nextIndex] != null) { MemoryAllocation allocation = allocations[nextIndex++]; if (clear) { clearMemory(allocation.address, bucket.size); } return allocation; } if (nextIndex >= allocations.length) { return null; } // None on the freelist for this magazine, allocate more long address; while ((address = IO.allocateMemory(bucket.size, clear)) == 0L) { System.gc(); } MemoryAllocation allocation = new MemoryAllocation(this, address); allocations[nextIndex++] = allocation; return allocation; }
MemoryAllocation allocate(boolean clear) { if (nextIndex < allocations.length && allocations[nextIndex] != null) { MemoryAllocation allocation = allocations[nextIndex++]; if (clear) { clearMemory(allocation.address, bucket.size); } return allocation; } if (nextIndex >= allocations.length) { return null; } // None on the freelist for this magazine, allocate more long address; while ((address = IO.allocateMemory(bucket.size, clear)) == 0L) { System.gc(); } MemoryAllocation allocation = new MemoryAllocation(this, address); allocations[nextIndex++] = allocation; return allocation; }
synchronized void recycle() { if (fragmented) { int size = bucket.size; for (int i = 0; i < allocations.length; i++) { MemoryAllocation m = allocations[i]; if (m != null) { if (m.isUnmanaged()) { allocations[i] = null; } else { clearMemory(allocations[i].address, size); } } } fragmented = false; } nextIndex = 0; bucket.recycle(this); } }
MemoryAllocation allocate(boolean clear) { if (nextIndex < allocations.length && allocations[nextIndex] != null) { MemoryAllocation allocation = allocations[nextIndex++]; if (clear) { clearMemory(allocation.address, bucket.size); } return allocation; } if (nextIndex >= allocations.length) { return null; } // None on the freelist for this magazine, allocate more long address; while ((address = IO.allocateMemory(bucket.size, clear)) == 0L) { System.gc(); } MemoryAllocation allocation = new MemoryAllocation(this, address); allocations[nextIndex++] = allocation; return allocation; }
synchronized void recycle() { if (fragmented) { int size = bucket.size; for (int i = 0; i < allocations.length; i++) { MemoryAllocation m = allocations[i]; if (m != null) { if (m.isUnmanaged()) { allocations[i] = null; } else { clearMemory(allocations[i].address, size); } } } fragmented = false; } nextIndex = 0; bucket.recycle(this); } }
synchronized void recycle() { if (fragmented) { int size = bucket.size; for (int i = 0; i < allocations.length; i++) { MemoryAllocation m = allocations[i]; if (m != null) { if (m.isUnmanaged()) { allocations[i] = null; } else { clearMemory(allocations[i].address, size); } } } fragmented = false; } nextIndex = 0; bucket.recycle(this); } }
synchronized void recycle() { if (fragmented) { int size = bucket.size; for (int i = 0; i < allocations.length; i++) { MemoryAllocation m = allocations[i]; if (m != null) { if (m.isUnmanaged()) { allocations[i] = null; } else { clearMemory(allocations[i].address, size); } } } fragmented = false; } nextIndex = 0; bucket.recycle(this); } }
MemoryAllocation allocate(boolean clear) { if (nextIndex < allocations.length && allocations[nextIndex] != null) { MemoryAllocation allocation = allocations[nextIndex++]; if (clear) { clearMemory(allocation.address, bucket.size); } return allocation; } if (nextIndex >= allocations.length) { return null; } // None on the freelist for this magazine, allocate more long address; while ((address = IO.allocateMemory(bucket.size, clear)) == 0L) { System.gc(); } MemoryAllocation allocation = new MemoryAllocation(this, address); allocations[nextIndex++] = allocation; return allocation; }
public void setAutoRelease(boolean autorelease) { allocation.setAutoRelease(autorelease); }
public void setAutoRelease(boolean autorelease) { allocation.setAutoRelease(autorelease); }
public void setAutoRelease(boolean autorelease) { allocation.setAutoRelease(autorelease); }
public boolean isAutoRelease() { return !allocation.isUnmanaged(); } }
public boolean isAutoRelease() { return !allocation.isUnmanaged(); } }
public boolean isAutoRelease() { return !allocation.isUnmanaged(); } }
final void free() { if ((flags & RELEASED) == 0) { flags = RELEASED | UNMANAGED; magazine.setFragmented(); dispose(); } } }
public void setAutoRelease(boolean autorelease) { allocation.setAutoRelease(autorelease); }
final void free() { if ((flags & RELEASED) == 0) { flags = RELEASED | UNMANAGED; magazine.setFragmented(); dispose(); } } }
synchronized void dispose() { for (int i = 0; i < allocations.length; i++) { MemoryAllocation m = allocations[i]; if (m != null && !m.isUnmanaged()) { m.dispose(); } } }
final void free() { if ((flags & RELEASED) == 0) { flags = RELEASED | UNMANAGED; magazine.setFragmented(); dispose(); } } }
synchronized void dispose() { for (int i = 0; i < allocations.length; i++) { MemoryAllocation m = allocations[i]; if (m != null && !m.isUnmanaged()) { m.dispose(); } } }