You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/03/18 03:14:00 UTC

[GitHub] [hudi] danny0405 commented on a change in pull request #5060: [HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint

danny0405 commented on a change in pull request #5060:
URL: https://github.com/apache/hudi/pull/5060#discussion_r829665766



##########
File path: hudi-common/src/main/java/org/apache/hudi/common/util/ObjectSizeCalculator.java
##########
@@ -92,6 +92,7 @@ public static long getObjectSize(Object obj) throws UnsupportedOperationExceptio
   private final Set<Object> alreadyVisited = Collections.newSetFromMap(new IdentityHashMap<>());
   private final Deque<Object> pending = new ArrayDeque<>(64);
   private long size;
+  private static final ThreadLocal<ObjectSizeCalculator> objectSizeCalculator = ThreadLocal.withInitial(() -> new ObjectSizeCalculator(CurrentLayout.SPEC));

Review comment:
       +1




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org