You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by xu...@apache.org on 2022/04/14 19:27:46 UTC

[hudi] branch revert-5060-feature/threadlocal_ObjectSizeCalculator2 created (now a45e51938a)

This is an automated email from the ASF dual-hosted git repository.

xushiyan pushed a change to branch revert-5060-feature/threadlocal_ObjectSizeCalculator2
in repository https://gitbox.apache.org/repos/asf/hudi.git


      at a45e51938a Revert "[HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint (#5060)"

This branch includes the following new commits:

     new a45e51938a Revert "[HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint (#5060)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[hudi] 01/01: Revert "[HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint (#5060)"

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xushiyan pushed a commit to branch revert-5060-feature/threadlocal_ObjectSizeCalculator2
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit a45e51938aa0eec643dbae4f27bfe33eaeaf4155
Author: Raymond Xu <27...@users.noreply.github.com>
AuthorDate: Thu Apr 14 12:27:42 2022 -0700

    Revert "[HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint (#5060)"
    
    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.