Repository: incubator-mnemonic
Updated Branches:
  refs/heads/master 66df08df4 -> 35383420f


MNEMONIC-120: Add flush()/sync() support on block level


Project: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/commit/35383420
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/tree/35383420
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/diff/35383420

Branch: refs/heads/master
Commit: 35383420fc780bec54e15d44c9cd12bd7afd3cca
Parents: 66df08d
Author: Wang, Gang(Gary) <gang1.w...@intel.com>
Authored: Wed Sep 21 15:48:48 2016 -0700
Committer: Wang, Gang(Gary) <gang1.w...@intel.com>
Committed: Wed Sep 21 16:00:54 2016 -0700

----------------------------------------------------------------------
 .../mnemonic/NonVolatileMemAllocator.java       | 104 +++++++++++++++++--
 .../apache/mnemonic/RetrievableAllocator.java   |  27 ++++-
 .../apache/mnemonic/VolatileMemAllocator.java   |  43 ++++++--
 .../NonVolatileMemoryAllocatorService.java      |  34 +++---
 .../VolatileMemoryAllocatorService.java         |  26 ++---
 .../memoryservice/internal/PMemServiceImpl.java |  40 +++----
 ...ice_memoryservice_internal_PMemServiceImpl.c |  91 +++++++++++++---
 .../memoryservice/internal/VMemServiceImpl.java |  23 ++--
 ...ice_memoryservice_internal_VMemServiceImpl.c |  22 ++--
 .../internal/PMallocServiceImpl.java            |  40 +++----
 ..._memoryservice_internal_PMallocServiceImpl.c |  82 +++++++++++----
 11 files changed, 367 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java 
b/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
index d070146..a88df4e 100644
--- 
a/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
+++ 
b/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
@@ -334,29 +334,29 @@ public class NonVolatileMemAllocator extends 
RestorableAllocator<NonVolatileMemA
   }
 
   /**
-   * get the handler from a memory buffer holder.
+   * get the address from a memory buffer holder.
    * 
    * @param mbuf
    *          specify the memory buffer holder
    *
-   * @return a handler that could be used to retrieve its memory buffer
+   * @return an address that could be used to retrieve its memory buffer
    */
   @Override
-  public long getBufferHandler(MemBufferHolder<NonVolatileMemAllocator> mbuf) {
-    return getPortableAddress(m_nvmasvc.getByteBufferHandler(m_nid, 
mbuf.get()));
+  public long getBufferAddress(MemBufferHolder<NonVolatileMemAllocator> mbuf) {
+    return m_nvmasvc.getByteBufferHandler(m_nid, mbuf.get());
   }
 
   /**
-   * get the handler from a memory chunk holder.
+   * get the address from a memory chunk holder.
    * 
    * @param mchunk
    *          specify the memory chunk holder
    *
-   * @return a handler that could be used to retrieve its memory chunk
+   * @return an address that could be used to retrieve its memory chunk
    */
   @Override
-  public long getChunkHandler(MemChunkHolder<NonVolatileMemAllocator> mchunk) {
-    return getPortableAddress(mchunk.get());
+  public long getChunkAddress(MemChunkHolder<NonVolatileMemAllocator> mchunk) {
+    return mchunk.get();
   }
 
   /**
@@ -371,6 +371,94 @@ public class NonVolatileMemAllocator extends 
RestorableAllocator<NonVolatileMemA
   }
 
   /**
+   * sync. a buffer to underlying memory device.
+   * 
+   * @param mbuf
+   *         specify a buffer to be sync.
+   */
+  public void sync(MemBufferHolder<NonVolatileMemAllocator> mbuf) {
+    m_nvmasvc.sync(m_nid, getBufferAddress(mbuf), 0L, true);
+  }
+
+  /**
+   * sync. a chunk to underlying memory device.
+   * 
+   * @param mchunk
+   *         specify a chunk to be sync.
+   */
+  public void sync(MemChunkHolder<NonVolatileMemAllocator> mchunk) {
+    m_nvmasvc.sync(m_nid, getChunkAddress(mchunk), 0L, true);
+  }
+
+  /**
+   * sync. the memory pool to underlying memory device.
+   */
+  public void syncAll() {
+    m_nvmasvc.sync(m_nid, 0L, 0L, true);
+  }
+
+  /**
+   * persist a buffer to persistent memory.
+   * 
+   * @param mbuf
+   *         specify a buffer to be persisted
+   */
+  public void persist(MemBufferHolder<NonVolatileMemAllocator> mbuf) {
+    m_nvmasvc.persist(m_nid, getBufferAddress(mbuf), 0L, true);
+  }
+
+  /**
+   * persist a chunk to persistent memory.
+   * 
+   * @param mchunk
+   *         specify a chunk to be persisted
+   */
+  public void persist(MemChunkHolder<NonVolatileMemAllocator> mchunk) {
+    m_nvmasvc.persist(m_nid, getChunkAddress(mchunk), 0L, true);
+  }
+
+  /**
+   * persist the memory pool to persistent memory.
+   */
+  public void persistAll() {
+    m_nvmasvc.persist(m_nid, 0L, 0L, true);
+  }
+
+  /**
+   * flush a buffer to persistent memory.
+   * 
+   * @param mbuf
+   *         specify a buffer to be flushed
+   */
+  public void flush(MemBufferHolder<NonVolatileMemAllocator> mbuf) {
+    m_nvmasvc.flush(m_nid, getBufferAddress(mbuf), 0L, true);
+  }
+
+  /**
+   * flush a chunk to persistent memory.
+   * 
+   * @param mchunk
+   *         specify a chunk to be flushed
+   */
+  public void flush(MemChunkHolder<NonVolatileMemAllocator> mchunk) {
+    m_nvmasvc.flush(m_nid, getChunkAddress(mchunk), 0L, true);
+  }
+
+  /**
+   * flush the memory pool to persistent memory.
+   */
+  public void flushAll() {
+    m_nvmasvc.flush(m_nid, 0L, 0L, true);
+  }
+
+  /**
+   * drain memory caches to persistent memory.
+   */
+  public void drain() {
+    m_nvmasvc.drain(m_nid);
+  }
+
+  /**
    * determine whether the allocator supports transaction feature or not
    *
    * @return true if supported

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-core/src/main/java/org/apache/mnemonic/RetrievableAllocator.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-core/src/main/java/org/apache/mnemonic/RetrievableAllocator.java 
b/mnemonic-core/src/main/java/org/apache/mnemonic/RetrievableAllocator.java
index 8140aa6..b8e5c92 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/RetrievableAllocator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/RetrievableAllocator.java
@@ -72,6 +72,25 @@ public abstract class RetrievableAllocator<A extends 
CommonAllocator<A>> extends
    */
   public abstract MemChunkHolder<A> retrieveChunk(long phandler, boolean 
autoreclaim);
 
+  /**
+   * get the address from a memory buffer holder.
+   * 
+   * @param mbuf
+   *          specify the memory buffer holder
+   *
+   * @return an address that could be used to retrieve its memory buffer
+   */
+  public abstract long getBufferAddress(MemBufferHolder<A> mbuf);
+
+  /**
+   * get the address from a memory chunk holder.
+   * 
+   * @param mchunk
+   *          specify the memory chunk holder
+   *
+   * @return an address that could be used to retrieve its memory chunk
+   */
+  public abstract long getChunkAddress(MemChunkHolder<A> mchunk);
 
   /**
    * get the handler from a memory buffer holder.
@@ -81,7 +100,9 @@ public abstract class RetrievableAllocator<A extends 
CommonAllocator<A>> extends
    *
    * @return a handler that could be used to retrieve its memory buffer
    */
-  public abstract long getBufferHandler(MemBufferHolder<A> mbuf);
+  public long getBufferHandler(MemBufferHolder<A> mbuf) {
+    return getPortableAddress(getBufferAddress(mbuf));
+  }
 
   /**
    * get the handler from a memory chunk holder.
@@ -91,6 +112,8 @@ public abstract class RetrievableAllocator<A extends 
CommonAllocator<A>> extends
    *
    * @return a handler that could be used to retrieve its memory chunk
    */
-  public abstract long getChunkHandler(MemChunkHolder<A> mchunk);
+  public long getChunkHandler(MemChunkHolder<A> mchunk) {
+    return getPortableAddress(getChunkAddress(mchunk));
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java 
b/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
index 18d31e1..453129b 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
@@ -328,29 +328,29 @@ public class VolatileMemAllocator extends 
RestorableAllocator<VolatileMemAllocat
   }
 
   /**
-   * get the handler from a memory buffer holder.
+   * get the address from a memory buffer holder.
    * 
    * @param mbuf
    *          specify the memory buffer holder
    *
-   * @return a handler that could be used to retrieve its memory buffer
+   * @return an address that could be used to retrieve its memory buffer
    */
   @Override
-  public long getBufferHandler(MemBufferHolder<VolatileMemAllocator> mbuf) {
-    return getPortableAddress(m_vmasvc.getByteBufferHandler(m_nid, 
mbuf.get()));
+  public long getBufferAddress(MemBufferHolder<VolatileMemAllocator> mbuf) {
+    return m_vmasvc.getByteBufferHandler(m_nid, mbuf.get());
   }
 
   /**
-   * get the handler from a memory chunk holder.
+   * get the address from a memory chunk holder.
    * 
    * @param mchunk
    *          specify the memory chunk holder
    *
-   * @return a handler that could be used to retrieve its memory chunk
+   * @return an address that could be used to retrieve its memory chunk
    */
   @Override
-  public long getChunkHandler(MemChunkHolder<VolatileMemAllocator> mchunk) {
-    return getPortableAddress(mchunk.get());
+  public long getChunkAddress(MemChunkHolder<VolatileMemAllocator> mchunk) {
+    return mchunk.get();
   }
 
   /**
@@ -365,6 +365,33 @@ public class VolatileMemAllocator extends 
RestorableAllocator<VolatileMemAllocat
   }
 
   /**
+   * sync. a buffer to underlying memory device.
+   * 
+   * @param mbuf
+   *         specify a buffer to be sync.
+   */
+  public void sync(MemBufferHolder<VolatileMemAllocator> mbuf) {
+    m_vmasvc.sync(m_nid, getBufferAddress(mbuf), 0L, true);
+  }
+
+  /**
+   * sync. a chunk to underlying memory device.
+   * 
+   * @param mchunk
+   *         specify a chunk to be sync.
+   */
+  public void sync(MemChunkHolder<VolatileMemAllocator> mchunk) {
+    m_vmasvc.sync(m_nid, getChunkAddress(mchunk), 0L, true);
+  }
+
+  /**
+   * sync. the memory pool to underlying memory device.
+   */
+  public void syncAll() {
+    m_vmasvc.sync(m_nid, 0L, 0L, true);
+  }
+
+  /**
    * determine whether the allocator supports transaction feature or not
    *
    * @return true if supported

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/NonVolatileMemoryAllocatorService.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/NonVolatileMemoryAllocatorService.java
 
b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/NonVolatileMemoryAllocatorService.java
index 65d190f..0504165 100644
--- 
a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/NonVolatileMemoryAllocatorService.java
+++ 
b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/NonVolatileMemoryAllocatorService.java
@@ -41,13 +41,13 @@ public interface NonVolatileMemoryAllocatorService extends 
VolatileMemoryAllocat
    * @param id
    *          the identifier of backed memory pool
    * 
-   * @param handler
-   *          the handler of a nonvolatile object
+   * @param addr
+   *          the address of a nonvolatile object
    *
    * @return the size of nonvolatile object
    *
    */
-  long retrieveSize(long id, long handler);
+  long retrieveSize(long id, long addr);
 
   /**
    * get the handler of a nonvolatile bytebuffer
@@ -101,26 +101,22 @@ public interface NonVolatileMemoryAllocatorService 
extends VolatileMemoryAllocat
   long handlerCapacity(long id);
 
   /**
-   * Make any cached changes to a whole pool persistent.
-   * 
-   * @param id
-   *          the identifier of backed memory pool
-   */
-  void persist(long id);
-
-  /**
    * Make any cached changes to a memory resource persistent.
    * 
    * @param id
    *          the identifier of backed memory pool
    * 
-   * @param address
+   * @param addr
    *          the address of a memory resource
    * 
-   * @param handler
+   * @param length
    *          the length of the memory resource
+   * 
+   * @param autodetect
+   *          NULL == address && autodetect : persist whole pool
+   *          0L == length && autodetect : persist block
    */
-  void persist(long id, long address, long length);
+  void persist(long id, long addr, long length, boolean autodetect);
 
   /**
    * flush processors cache for a memory resource
@@ -128,13 +124,17 @@ public interface NonVolatileMemoryAllocatorService 
extends VolatileMemoryAllocat
    * @param id
    *          the identifier of backed memory pool
    * 
-   * @param address
+   * @param addr
    *          the address of a memory resource
    * 
-   * @param handler
+   * @param length
    *          the length of the memory resource
+   * 
+   * @param autodetect
+   *          NULL == address && autodetect : flush whole pool
+   *          0L == length && autodetect : flush block
    */
-  void flush(long id, long address, long length);
+  void flush(long id, long addr, long length, boolean autodetect);
 
   /**
    * wait for any memory resource stores to drain from HW buffers.

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/VolatileMemoryAllocatorService.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/VolatileMemoryAllocatorService.java
 
b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/VolatileMemoryAllocatorService.java
index 63f50b7..7f9f7dc 100644
--- 
a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/VolatileMemoryAllocatorService.java
+++ 
b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memoryservice/VolatileMemoryAllocatorService.java
@@ -143,26 +143,22 @@ public interface VolatileMemoryAllocatorService {
   void close(long id);
 
   /**
-   * force to synchronize all uncommitted data to backed memory pool.
-   *
-   * @param id
-   *         specify the id of underlying native allocator
-   */
-  void sync(long id);
-
-  /**
    * force to synchronize an uncommitted data to backed memory pool.
    *
    * @param id
    *         specify the id of underlying native allocator
    * 
-   * @param address
+   * @param addr
    *          the address of a memory resource
    * 
-   * @param handler
+   * @param length
    *          the length of the memory resource
+   * 
+   * @param autodetect
+   *          NULL == address && autodetect : sync. whole pool
+   *          0L == length && autodetect : sync. block
    */
-  void sync(long id, long address, long length);
+  void sync(long id, long addr, long length, boolean autodetect);
 
   /**
    * get the capacity of its managed memory space
@@ -196,7 +192,7 @@ public interface VolatileMemoryAllocatorService {
    * @param id
    *          the identifier of backed memory pool
    * 
-   * @param address
+   * @param addr
    *          the address of previous allocated memory block. it can be null.
    * 
    * @param size
@@ -207,7 +203,7 @@ public interface VolatileMemoryAllocatorService {
    *
    * @return the address of reallocated memory block from native memory pool
    */
-  long reallocate(long id, long address, long size, boolean initzero);
+  long reallocate(long id, long addr, long size, boolean initzero);
 
   /**
    * free a memory block by specify its address into backed memory pool.
@@ -215,10 +211,10 @@ public interface VolatileMemoryAllocatorService {
    * @param id
    *          the identifier of backed memory pool
    * 
-   * @param address
+   * @param addr
    *          the address of allocated memory block.
    */
-  void free(long id, long address);
+  void free(long id, long addr);
 
   /**
    * create a ByteBuffer object which backed buffer is coming from backed 
native

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMemServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMemServiceImpl.java
 
b/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMemServiceImpl.java
index 8bd5bff..cfd5b38 100644
--- 
a/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMemServiceImpl.java
+++ 
b/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMemServiceImpl.java
@@ -47,13 +47,8 @@ public class PMemServiceImpl implements 
NonVolatileMemoryAllocatorService {
   }
 
   @Override
-  public void sync(long id) {
-    nsync(id, ngetBaseAddress(id), nhandlerCapacity(id));
-  }
-
-  @Override
-  public void sync(long id, long address, long length) {
-    nsync(id, address, length);
+  public void sync(long id, long addr, long length, boolean autodetect) {
+    nsync(id, addr, length, autodetect);
   }
 
   @Override
@@ -67,13 +62,13 @@ public class PMemServiceImpl implements 
NonVolatileMemoryAllocatorService {
   }
 
   @Override
-  public long reallocate(long id, long address, long size, boolean initzero) {
-    return nreallocate(id, address, size, initzero);
+  public long reallocate(long id, long addr, long size, boolean initzero) {
+    return nreallocate(id, addr, size, initzero);
   }
 
   @Override
-  public void free(long id, long address) {
-    nfree(id, address);
+  public void free(long id, long addr) {
+    nfree(id, addr);
   }
 
   @Override
@@ -122,18 +117,13 @@ public class PMemServiceImpl implements 
NonVolatileMemoryAllocatorService {
   }
 
   @Override
-  public void persist(long id) {
-    npersist(id, ngetBaseAddress(id), nhandlerCapacity(id));
-  }
-
-  @Override
-  public void persist(long id, long address, long length) {
-    npersist(id, address, length);
+  public void persist(long id, long addr, long length, boolean autodetect) {
+    npersist(id, addr, length, autodetect);
   }
 
   @Override
-  public void flush(long id, long address, long length) {
-    nflush(id, address, length);
+  public void flush(long id, long addr, long length, boolean autodetect) {
+    nflush(id, addr, length, autodetect);
   }
 
   @Override
@@ -150,15 +140,15 @@ public class PMemServiceImpl implements 
NonVolatileMemoryAllocatorService {
 
   protected native void nclose(long id);
 
-  protected native void nsync(long id, long address, long length);
+  protected native void nsync(long id, long addr, long length, boolean 
autodetect);
 
   protected native long ncapacity(long id);
 
   protected native long nallocate(long id, long size, boolean initzero);
 
-  protected native long nreallocate(long id, long address, long size, boolean 
initzero);
+  protected native long nreallocate(long id, long addr, long size, boolean 
initzero);
 
-  protected native void nfree(long id, long address);
+  protected native void nfree(long id, long addr);
 
   protected native ByteBuffer ncreateByteBuffer(long id, long size);
 
@@ -178,9 +168,9 @@ public class PMemServiceImpl implements 
NonVolatileMemoryAllocatorService {
 
   protected native long nhandlerCapacity(long id);
 
-  protected native void npersist(long id, long address, long length);
+  protected native void npersist(long id, long addr, long length, boolean 
autodetect);
 
-  protected native void nflush(long id, long address, long length);
+  protected native void nflush(long id, long addr, long length, boolean 
autodetect);
 
   protected native void ndrain(long id);
 

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl.c
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl.c
 
b/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl.c
index 0cfc175..f6286de 100644
--- 
a/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl.c
+++ 
b/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl.c
@@ -46,13 +46,13 @@ jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServic
 
 JNIEXPORT
 jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl_nreallocate(JNIEnv*
 env,
-    jobject this, jlong id, jlong e_addr, jlong size, jboolean initzero) {
+    jobject this, jlong id, jlong addr, jlong size, jboolean initzero) {
   PMPool *pool;
   jlong ret = 0L;
   void *p;
   pthread_rwlock_rdlock(&g_pmp_rwlock);
   pool = g_pmpool_arr + id;
-  p = addr_from_java(e_addr);
+  p = addr_from_java(addr);
   p = prealloc(pool, p, size, initzero ? 1 : 0);
   if (NULL != p) {
     ret = addr_to_java(p);
@@ -65,14 +65,14 @@ JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl_nfree(
     JNIEnv* env,
     jobject this, jlong id,
-    jlong e_addr)
+    jlong addr)
 {
   PMPool *pool;
   void* nativebuf;
   pthread_rwlock_rdlock(&g_pmp_rwlock);
   pool = g_pmpool_arr + id;
-  //fprintf(stderr, "nfree Get Called %ld, %X\n", id, address);
-  nativebuf = addr_from_java(e_addr);
+  //fprintf(stderr, "nfree Get Called %ld, %X\n", id, addr);
+  nativebuf = addr_from_java(addr);
   pfree(pool, nativebuf);
   pthread_rwlock_unlock(&g_pmp_rwlock);
 }
@@ -80,25 +80,82 @@ void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemService
 JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl_nsync(
     JNIEnv* env,
-    jobject this, jlong id, jlong address, jlong len)
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
 {
-  pmem_msync(addr_from_java(address), len);
+  PMPool *pool;
+  size_t capa;
+  void* nativebuf;
+  void* p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmem_msync(nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pthread_rwlock_rdlock(&g_pmp_rwlock);
+      pool = g_pmpool_arr + id;
+      capa = pool->capacity;
+      pmem_msync(pool->base, capa);
+      pthread_rwlock_unlock(&g_pmp_rwlock);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmem_msync(p, len);
+    }
+  }
 }
 
 JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl_npersist(
     JNIEnv* env,
-    jobject this, jlong id, jlong address, jlong len)
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
 {
-  pmem_persist(addr_from_java(address), len);
+  PMPool *pool;
+  size_t capa;
+  void* nativebuf;
+  void* p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmem_persist(nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pthread_rwlock_rdlock(&g_pmp_rwlock);
+      pool = g_pmpool_arr + id;
+      capa = pool->capacity;
+      pmem_persist(pool->base, capa);
+      pthread_rwlock_unlock(&g_pmp_rwlock);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmem_persist(p, len);
+    }
+  }
 }
 
 JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl_nflush(
     JNIEnv* env,
-    jobject this, jlong id, jlong address, jlong len)
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
 {
-  pmem_flush(addr_from_java(address), len);
+  PMPool *pool;
+  size_t capa;
+  void* nativebuf;
+  void* p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmem_flush(nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pthread_rwlock_rdlock(&g_pmp_rwlock);
+      pool = g_pmpool_arr + id;
+      capa = pool->capacity;
+      pmem_flush(pool->base, capa);
+      pthread_rwlock_unlock(&g_pmp_rwlock);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmem_flush(p, len);
+    }
+  }
 }
 
 JNIEXPORT
@@ -141,9 +198,9 @@ jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServ
 
 JNIEXPORT
 jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl_nretrieveByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jlong e_addr) {
+    JNIEnv *env, jobject this, jlong id, jlong addr) {
   jobject ret = NULL;
-  void* p = addr_from_java(e_addr);
+  void* p = addr_from_java(addr);
   if (NULL != p) {
     void* nativebuf = p - PMBHSZ;
     ret = (*env)->NewDirectByteBuffer(env, p, ((PMBHeader *) nativebuf)->size 
- PMBHSZ);
@@ -153,9 +210,9 @@ jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServ
 
 JNIEXPORT
 jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServiceImpl_nretrieveSize(JNIEnv
 *env,
-    jobject this, jlong id, jlong e_addr) {
+    jobject this, jlong id, jlong addr) {
   jlong ret = 0L;
-  void* p = addr_from_java(e_addr);
+  void* p = addr_from_java(addr);
   if (NULL != p) {
     void* nativebuf = p - PMBHSZ;
     ret = ((PMBHeader *) nativebuf)->size - PMBHSZ;
@@ -172,10 +229,10 @@ jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMemServic
   jlong ret = 0L;
   if (NULL != bytebuf) {
     void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
-//     fprintf(stderr, "ngetByteBufferAddress Get Native address %X\n", 
nativebuf);
+//     fprintf(stderr, "ngetByteBufferAddress Get Native addr %X\n", 
nativebuf);
     ret = addr_to_java(nativebuf);
   }
-//    fprintf(stderr, "ngetByteBufferAddress returned address %016lx\n", ret);
+//    fprintf(stderr, "ngetByteBufferAddress returned addr %016lx\n", ret);
   return ret;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
index a4adc36..50ca72d 100644
--- 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
+++ 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
@@ -54,13 +54,8 @@ public class VMemServiceImpl implements 
VolatileMemoryAllocatorService {
   }
 
   @Override
-  public void sync(long id) {
-    nsync(id, ngetBaseAddress(id), nhandlerCapacity(id));
-  }
-
-  @Override
-  public void sync(long id, long address, long length) {
-    nsync(id, address, length);
+  public void sync(long id, long addr, long length, boolean autodetect) {
+    nsync(id, addr, length, autodetect);
   }
 
   @Override
@@ -74,13 +69,13 @@ public class VMemServiceImpl implements 
VolatileMemoryAllocatorService {
   }
 
   @Override
-  public long reallocate(long id, long address, long size, boolean initzero) {
-    return nreallocate(id, address, size, initzero);
+  public long reallocate(long id, long addr, long size, boolean initzero) {
+    return nreallocate(id, addr, size, initzero);
   }
 
   @Override
-  public void free(long id, long address) {
-    nfree(id, address);
+  public void free(long id, long addr) {
+    nfree(id, addr);
   }
 
   @Override
@@ -137,15 +132,15 @@ public class VMemServiceImpl implements 
VolatileMemoryAllocatorService {
 
   protected native void nclose(long id);
 
-  protected native void nsync(long id, long address, long length);
+  protected native void nsync(long id, long addr, long length, boolean 
autodetect);
 
   protected native long ncapacity(long id);
 
   protected native long nallocate(long id, long size, boolean initzero);
 
-  protected native long nreallocate(long id, long address, long size, boolean 
initzero);
+  protected native long nreallocate(long id, long addr, long size, boolean 
initzero);
 
-  protected native void nfree(long id, long address);
+  protected native void nfree(long id, long addr);
 
   protected native ByteBuffer ncreateByteBuffer(long id, long size);
 

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
index 3dd5a2d..c25777d 100644
--- 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
+++ 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
@@ -44,11 +44,11 @@ jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServic
 
 JNIEXPORT
 jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nreallocate(JNIEnv*
 env,
-    jobject this, jlong id, jlong address, jlong size, jboolean initzero) {
+    jobject this, jlong id, jlong addr, jlong size, jboolean initzero) {
   pthread_rwlock_rdlock(&g_vmem_rwlock);
   pthread_mutex_lock(g_vmem_mutex_ptr + id);
 
-  void* p = addr_from_java(address);
+  void* p = addr_from_java(addr);
 
   void* nativebuf = vmem_realloc(*(g_vmp_ptr + id), p, size);
 
@@ -61,11 +61,11 @@ JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nfree(
     JNIEnv* env,
     jobject this, jlong id,
-    jlong address)
+    jlong addr)
 {
   pthread_rwlock_rdlock(&g_vmem_rwlock);
   pthread_mutex_lock(g_vmem_mutex_ptr + id);
-  void* nativebuf = addr_from_java(address);
+  void* nativebuf = addr_from_java(addr);
   if (nativebuf != NULL)
   vmem_free(*(g_vmp_ptr + id), nativebuf);
   pthread_mutex_unlock(g_vmem_mutex_ptr + id);
@@ -75,7 +75,7 @@ void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemService
 JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nsync(
     JNIEnv* env,
-    jobject this, jlong id, jlong address, jlong len)
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
 {
 }
 
@@ -102,18 +102,18 @@ jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServ
 
 JNIEXPORT
 jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nretrieveByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jlong e_addr, jlong size) {
+    JNIEnv *env, jobject this, jlong id, jlong addr, jlong size) {
   jobject ret = NULL;
-  void* p = addr_from_java(e_addr);
+  void* p = addr_from_java(addr);
   ret = NULL != p ? (*env)->NewDirectByteBuffer(env, p, size) : NULL;
   return ret;
 }
 
 JNIEXPORT
 jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nretrieveSize(JNIEnv
 *env,
-    jobject this, jlong id, jlong e_addr, jlong size) {
+    jobject this, jlong id, jlong addr, jlong size) {
   jlong ret = 0L;
-  void* p = addr_from_java(e_addr);
+  void* p = addr_from_java(addr);
   ret = NULL != p ? (*env)->NewDirectByteBuffer(env, p, size) : NULL;
   return ret;
 }
@@ -125,10 +125,10 @@ jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServic
   jlong ret = 0L;
   if (NULL != bytebuf) {
     void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
-//      fprintf(stderr, "ngetByteBufferAddress Get Native address %X\n", 
nativebuf);
+//      fprintf(stderr, "ngetByteBufferAddress Get Native addr %X\n", 
nativebuf);
     ret = addr_to_java(nativebuf);
   }
-//    fprintf(stderr, "ngetByteBufferAddress returned address %016lx\n", ret);
+//    fprintf(stderr, "ngetByteBufferAddress returned addr %016lx\n", ret);
   return ret;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
index 1e27825..6edace3 100644
--- 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
+++ 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
@@ -47,13 +47,8 @@ public class PMallocServiceImpl implements 
NonVolatileMemoryAllocatorService {
   }
 
   @Override
-  public void sync(long id) {
-    nsync(id, ngetBaseAddress(id), nhandlerCapacity(id));
-  }
-
-  @Override
-  public void sync(long id, long address, long length) {
-    nsync(id, address, length);
+  public void sync(long id, long addr, long length, boolean autodetect) {
+    nsync(id, addr, length, autodetect);
   }
 
   @Override
@@ -67,13 +62,13 @@ public class PMallocServiceImpl implements 
NonVolatileMemoryAllocatorService {
   }
 
   @Override
-  public long reallocate(long id, long address, long size, boolean initzero) {
-    return nreallocate(id, address, size, initzero);
+  public long reallocate(long id, long addr, long size, boolean initzero) {
+    return nreallocate(id, addr, size, initzero);
   }
 
   @Override
-  public void free(long id, long address) {
-    nfree(id, address);
+  public void free(long id, long addr) {
+    nfree(id, addr);
   }
 
   @Override
@@ -122,18 +117,13 @@ public class PMallocServiceImpl implements 
NonVolatileMemoryAllocatorService {
   }
 
   @Override
-  public void persist(long id) {
-    npersist(id, ngetBaseAddress(id), nhandlerCapacity(id));
-  }
-
-  @Override
-  public void persist(long id, long address, long length) {
-    npersist(id, address, length);
+  public void persist(long id, long addr, long length, boolean autodetect) {
+    npersist(id, addr, length, autodetect);
   }
 
   @Override
-  public void flush(long id, long address, long length) {
-    nflush(id, address, length);
+  public void flush(long id, long addr, long length, boolean autodetect) {
+    nflush(id, addr, length, autodetect);
   }
 
   @Override
@@ -150,15 +140,15 @@ public class PMallocServiceImpl implements 
NonVolatileMemoryAllocatorService {
 
   protected native void nclose(long id);
 
-  protected native void nsync(long id, long address, long length);
+  protected native void nsync(long id, long addr, long length, boolean 
autodetect);
 
   protected native long ncapacity(long id);
 
   protected native long nallocate(long id, long size, boolean initzero);
 
-  protected native long nreallocate(long id, long address, long size, boolean 
initzero);
+  protected native long nreallocate(long id, long addr, long size, boolean 
initzero);
 
-  protected native void nfree(long id, long address);
+  protected native void nfree(long id, long addr);
 
   protected native ByteBuffer ncreateByteBuffer(long id, long size);
 
@@ -178,9 +168,9 @@ public class PMallocServiceImpl implements 
NonVolatileMemoryAllocatorService {
 
   protected native long nhandlerCapacity(long id);
 
-  protected native void npersist(long id, long address, long length);
+  protected native void npersist(long id, long addr, long length, boolean 
autodetect);
 
-  protected native void nflush(long id, long address, long length);
+  protected native void nflush(long id, long addr, long length, boolean 
autodetect);
 
   protected native void ndrain(long id);
 

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/35383420/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
index d64cf03..487980f 100644
--- 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
+++ 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
@@ -59,13 +59,13 @@ jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocSer
 
 JNIEXPORT
 jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nreallocate(JNIEnv*
 env,
-    jobject this, jlong id, jlong address, jlong size, jboolean initzero) {
+    jobject this, jlong id, jlong addr, jlong size, jboolean initzero) {
   pthread_rwlock_rdlock(&g_pmp_rwlock);
   pthread_mutex_lock(g_pmalloc_mutex_ptr + id);
   jlong ret = 0L;
   void *md = *(g_pmp_ptr + id);
   void* nativebuf = NULL;
-  void* p = addr_from_java(address);
+  void* p = addr_from_java(addr);
   if (NULL != p) {
     nativebuf = pmrealloc(md, p - PMBHSZ, size + PMBHSZ);
   } else {
@@ -84,13 +84,13 @@ JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nfree(
     JNIEnv* env,
     jobject this, jlong id,
-    jlong address)
+    jlong addr)
 {
   pthread_rwlock_rdlock(&g_pmp_rwlock);
   pthread_mutex_lock(g_pmalloc_mutex_ptr + id);
-  //fprintf(stderr, "nfree Get Called %ld, %X\n", id, address);
+  //fprintf(stderr, "nfree Get Called %ld, %X\n", id, addr);
   void *md = *(g_pmp_ptr + id);
-  void* nativebuf = addr_from_java(address);
+  void* nativebuf = addr_from_java(addr);
   if (nativebuf != NULL) {
 //        fprintf(stderr, "### nfree size: %lld, %X ###, header size: %ld \n",
 //                     ((PMBHeader *)(nativebuf - PMBHSZ))->size, nativebuf - 
PMBHSZ-b_addr(*(g_pmp_ptr + id)), PMBHSZ);
@@ -103,36 +103,72 @@ void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServ
 JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nsync(
     JNIEnv* env,
-    jobject this, jlong id, jlong address, jlong len)
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
 {
+  void *nativebuf;
   void *md = *(g_pmp_ptr + id);
-  void* nativebuf = addr_from_java(address);
-  if (nativebuf != NULL) {
-    pmsync(md, nativebuf, len);
+  void *p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmsync(md, nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pthread_rwlock_rdlock(&g_pmp_rwlock);
+      pmsync(md, b_addr(md), pmcapacity(md));
+      pthread_rwlock_unlock(&g_pmp_rwlock);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmsync(md, p, len);
+    }
   }
 }
 
 JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_npersist(
     JNIEnv* env,
-    jobject this, jlong id, jlong address, jlong len)
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
 {
+  void *nativebuf;
   void *md = *(g_pmp_ptr + id);
-  void* nativebuf = addr_from_java(address);
-  if (nativebuf != NULL) {
-    pmsync(md, nativebuf, len);
+  void *p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmsync(md, nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pthread_rwlock_rdlock(&g_pmp_rwlock);
+      pmsync(md, b_addr(md), pmcapacity(md));
+      pthread_rwlock_unlock(&g_pmp_rwlock);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmsync(md, p, len);
+    }
   }
 }
 
 JNIEXPORT
 void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nflush(
     JNIEnv* env,
-    jobject this, jlong id, jlong address, jlong len)
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
 {
+  void *nativebuf;
   void *md = *(g_pmp_ptr + id);
-  void* nativebuf = addr_from_java(address);
-  if (nativebuf != NULL) {
-    pmsync(md, nativebuf, len);
+  void *p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmsync(md, nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pthread_rwlock_rdlock(&g_pmp_rwlock);
+      pmsync(md, b_addr(md), pmcapacity(md));
+      pthread_rwlock_unlock(&g_pmp_rwlock);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmsync(md, p, len);
+    }
   }
 }
 
@@ -176,9 +212,9 @@ jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocS
 
 JNIEXPORT
 jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nretrieveByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jlong e_addr) {
+    JNIEnv *env, jobject this, jlong id, jlong addr) {
   jobject ret = NULL;
-  void* p = addr_from_java(e_addr);
+  void* p = addr_from_java(addr);
   if (NULL != p) {
     void* nativebuf = p - PMBHSZ;
     ret = (*env)->NewDirectByteBuffer(env, p, ((PMBHeader *) nativebuf)->size 
- PMBHSZ);
@@ -188,9 +224,9 @@ jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocS
 
 JNIEXPORT
 jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nretrieveSize(JNIEnv
 *env,
-    jobject this, jlong id, jlong e_addr) {
+    jobject this, jlong id, jlong addr) {
   jlong ret = 0L;
-  void* p = addr_from_java(e_addr);
+  void* p = addr_from_java(addr);
   if (NULL != p) {
     void* nativebuf = p - PMBHSZ;
     ret = ((PMBHeader *) nativebuf)->size - PMBHSZ;
@@ -207,10 +243,10 @@ jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocSer
   jlong ret = 0L;
   if (NULL != bytebuf) {
     void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
-//     fprintf(stderr, "ngetByteBufferAddress Get Native address %X\n", 
nativebuf);
+//     fprintf(stderr, "ngetByteBufferAddress Get Native addr %X\n", 
nativebuf);
     ret = addr_to_java(nativebuf);
   }
-//    fprintf(stderr, "ngetByteBufferAddress returned address %016lx\n", ret);
+//    fprintf(stderr, "ngetByteBufferAddress returned addr %016lx\n", ret);
   return ret;
 }
 


Reply via email to