This is an automated email from the ASF dual-hosted git repository. xushiyan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push: new d6a64f765e Revert "[HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint (#5060)" (#5323) d6a64f765e is described below commit d6a64f765ee150e9d415efc55b6b4cc5c8e770ec Author: Raymond Xu <2701446+xushi...@users.noreply.github.com> AuthorDate: Thu Apr 14 12:28:27 2022 -0700 Revert "[HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint (#5060)" (#5323) This reverts commit f0ab4a6e9ef433ac943d2409051418f7f80a6902. --- .../main/java/org/apache/hudi/common/util/ObjectSizeCalculator.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hudi-common/src/main/java/org/apache/hudi/common/util/ObjectSizeCalculator.java b/hudi-common/src/main/java/org/apache/hudi/common/util/ObjectSizeCalculator.java index 99b2d5a2cb..7e625e8eb4 100644 --- a/hudi-common/src/main/java/org/apache/hudi/common/util/ObjectSizeCalculator.java +++ b/hudi-common/src/main/java/org/apache/hudi/common/util/ObjectSizeCalculator.java @@ -54,8 +54,6 @@ import java.util.Set; * @author Attila Szegedi */ public class ObjectSizeCalculator { - private static final ThreadLocal<ObjectSizeCalculator> OBJECT_SIZE_CALCULATOR_THREAD_LOCAL = ThreadLocal.withInitial(() -> new ObjectSizeCalculator(CurrentLayout.SPEC)); - private static class CurrentLayout { private static final MemoryLayoutSpecification SPEC = getEffectiveMemoryLayoutSpecification(); @@ -73,7 +71,7 @@ public class ObjectSizeCalculator { * @throws UnsupportedOperationException if the current vm memory layout cannot be detected. */ public static long getObjectSize(Object obj) throws UnsupportedOperationException { - return obj == null ? 0 : OBJECT_SIZE_CALCULATOR_THREAD_LOCAL.get().calculateObjectSize(obj); + return obj == null ? 0 : new ObjectSizeCalculator(CurrentLayout.SPEC).calculateObjectSize(obj); } // Fixed object header size for arrays.