/** * Allocates a byte buffer of at least the given size. * <p> * This {@code BufferSource} is limited to allocating regions that are a power * of two in size. Supplied sizes are therefore rounded up to the next * largest power of two. * * @return a buffer of at least the given size */ @Override public Page allocate(int size, boolean thief, boolean victim, OffHeapStorageArea owner) { if (thief) { return allocateAsThief(size, victim, owner); } else { return allocateFromFree(size, victim, owner); } }
/** * Allocates a byte buffer of at least the given size. * <p> * This {@code BufferSource} is limited to allocating regions that are a power * of two in size. Supplied sizes are therefore rounded up to the next * largest power of two. * * @return a buffer of at least the given size */ @Override public Page allocate(int size, boolean thief, boolean victim, OffHeapStorageArea owner) { if (thief) { return allocateAsThief(size, victim, owner); } else { return allocateFromFree(size, victim, owner); } }
private Page allocateAsThief(final int size, boolean victim, OffHeapStorageArea owner) { Page free = allocateFromFree(size, victim, owner); free(p); return allocateFromFree(size, victim, owner); } else { for (Page p : targets) {
private Page allocateAsThief(final int size, boolean victim, OffHeapStorageArea owner) { Page free = allocateFromFree(size, victim, owner); free(p); return allocateFromFree(size, victim, owner); } else { for (Page p : targets) {