core/src/main/java/com/orientechnologies/common/directmemory/OByteBufferPool.java
public final OPointer acquireDirect(boolean clear) {
    OPointer pointer;

    pointer = pointersPool.poll();

    if (pointer != null) {
      pointersPoolSize.decrementAndGet();
    } else {
      pointer = allocator.allocate(pageSize, -1);
    }

    if (clear) {
      pointer.clear();
    }

    final ByteBuffer buffer = pointer.getNativeByteBuffer();
    buffer.position(0);

    if (TRACK) {
      pointerMapping.put(pointer, generatePointer());
    }

    return pointer;
  }
public final OPointer acquireDirect(boolean clear) {
    OPointer pointer;

    pointer = pointersPool.poll();

    if (pointer != null) {
      pointersPoolSize.decrementAndGet();
    } else {
      pointer = allocator.allocate(pageSize, -1);
    }

    if (clear) {
      pointer.clear();
    }

    final ByteBuffer buffer = pointer.getNativeByteBuffer();
    buffer.position(0);

    if (TRACK) {
      pointerMapping.put(pointer, generatePointer());
    }

    return pointer;
  }
Acquires direct memory buffer with native byte order.
If there is free (already released) direct memory page we reuse it, otherwise new
memory chunk is allocated from direct memory.

@param clear Whether returned buffer should be filled with zeros before return.

@return Direct memory buffer instance.