Permalink
Browse files

fix double-counting of bytebuffer shallow size when omitSharedBufferO…

…verhead is set
  • Loading branch information...
1 parent fbf81cc commit 05c1cb53a260d3df2ca06901dc065d14a5f742a7 Jonathan Ellis committed Sep 14, 2011
Showing with 3 additions and 4 deletions.
  1. +1 −1 build.xml
  2. +2 −3 src/org/github/jamm/MemoryMeter.java
View
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="jamm" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="debuglevel" value="source,lines,vars"/>
- <property name="version" value="0.2.4"/>
+ <property name="version" value="0.2.5"/>
<property name="basedir" value="."/>
<property name="build.src" value="${basedir}/src"/>
@@ -104,9 +104,8 @@ public long measureDeep(Object object) {
if (current instanceof Object[]) {
addArrayChildren((Object[]) current, stack, tracker);
} else if (current instanceof ByteBuffer && !includeBufferSize) {
- ByteBuffer buffer = (ByteBuffer) current;
- // reference [to array] + int offset
- total += 8 + 4;
+ // we already added shallow size of the ByteBuffer array reference + int offset.
+ // nothing more to do here.
} else {
// TODO does this work correctly with native allocation like DirectByteBuffer?
addFieldChildren(current, stack, tracker);

0 comments on commit 05c1cb5

Please sign in to comment.