Ejemplo n.º 1
0
  private void performRelease() {
    if (refCount.get() > 0) {
      LOGGER.info("NativeBytesStore discarded without releasing ", createdHere);
    }

    memory = null;
    if (cleaner != null) cleaner.clean();
  }
Ejemplo n.º 2
0
 public static void cleanDirectBuffer(Buffer mappedFile) {
   if (mappedFile instanceof DirectBuffer) {
     Cleaner cleaner = ((DirectBuffer) mappedFile).cleaner();
     if (cleaner != null) {
       cleaner.clean();
     }
   }
 }
Ejemplo n.º 3
0
 /**
  * Force to unmap direct buffer if the buffer is no longer used. It is unsafe operation and
  * currently a walk-around to avoid huge memory occupation caused by memory map.
  *
  * @param buffer the byte buffer to be unmapped
  */
 public static void cleanDirectBuffer(ByteBuffer buffer) {
   if (buffer == null) {
     return;
   }
   if (buffer.isDirect()) {
     Cleaner cleaner = ((DirectBuffer) buffer).cleaner();
     cleaner.clean();
   }
 }
Ejemplo n.º 4
0
 public void free() {
   cleaner.clean();
 }
Ejemplo n.º 5
0
 private void clean(MappedByteBuffer mapping) {
   if (mapping == null) return;
   Cleaner cleaner = ((DirectBuffer) mapping).cleaner();
   if (cleaner != null) cleaner.clean();
 }
Ejemplo n.º 6
0
 @Override
 public void free() {
   cleaner.clean();
 }