This is an automated email from the ASF dual-hosted git repository.
zhouxj pushed a commit to branch feature/GEODE-6414
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-6414 by this
push:
new d606714 GEODE-6414: when create a new PdxInstanceImpl(), the
BufferBuffer will
d606714 is described below
commit d60671427c998df674f57110939dcfa747b0fd3d
Author: Jianxia Chen <[email protected]>
AuthorDate: Fri Feb 15 16:52:28 2019 -0800
GEODE-6414: when create a new PdxInstanceImpl(), the BufferBuffer will
be sliced and copied to a new one to reduce memory usuage.
Co-authored-by: Darrel Schneider <[email protected]>
Co-authored-by: Xiaojian Zhou <[email protected]>
Co-authored-by: Jianxia Chen <[email protected]>
---
.../main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git
a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java
b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java
index 9c9cdbc..e5c44e0 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java
@@ -954,7 +954,13 @@ public class PdxWriterImpl implements PdxWriter {
if (pt == null) {
pt = this.existingType;
}
- return new PdxInstanceImpl(pt, new PdxInputStream(bb), len);
+ bb = bb.slice();
+
+ ByteBuffer bbCopy = ByteBuffer.allocate(bb.capacity());
+ bb.rewind();
+ bbCopy.put(bb);
+ bbCopy.flip();
+ return new PdxInstanceImpl(pt, new PdxInputStream(bbCopy), len);
}
public static boolean isPdx(byte[] valueBytes) {