From 4f545ea09c266c21b2398315be2f3e1a7a453204 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 27 Sep 2010 22:43:59 +0000 Subject: [PATCH] Attempting to fix TestHeapSize on Hudson (align array heapsize) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1001944 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/hadoop/hbase/KeyValue.java | 5 +++-- src/main/java/org/apache/hadoop/hbase/util/ClassSize.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/KeyValue.java b/src/main/java/org/apache/hadoop/hbase/KeyValue.java index 14c5c8c4861..6ab3f5dea03 100644 --- a/src/main/java/org/apache/hadoop/hbase/KeyValue.java +++ b/src/main/java/org/apache/hadoop/hbase/KeyValue.java @@ -1930,9 +1930,10 @@ public class KeyValue implements Writable, HeapSize { // HeapSize public long heapSize() { return ClassSize.align(ClassSize.OBJECT + (2 * ClassSize.REFERENCE) + - ClassSize.align(ClassSize.ARRAY + length) + + ClassSize.align(ClassSize.ARRAY) + ClassSize.align(length) + (3 * Bytes.SIZEOF_INT) + - ClassSize.align(ClassSize.ARRAY + (rowCache == null ? 0 : rowCache.length)) + + ClassSize.align(ClassSize.ARRAY) + + ClassSize.align((rowCache == null ? 0 : rowCache.length)) + (2 * Bytes.SIZEOF_LONG)); } diff --git a/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java b/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java index c7d94e2aa0c..9ada18c8280 100755 --- a/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java +++ b/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java @@ -118,7 +118,7 @@ public class ClassSize { OBJECT = 2 * REFERENCE; - ARRAY = 3 * REFERENCE; + ARRAY = align(3 * REFERENCE); ARRAYLIST = align(OBJECT + align(REFERENCE) + align(ARRAY) + (2 * Bytes.SIZEOF_INT));