[ https://issues.apache.org/jira/browse/HUDI-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated HUDI-3652: --------------------------------- Labels: pull-request-available (was: ) > use threadlocal to decrease ObjectSizeCalculator memory use > ----------------------------------------------------------- > > Key: HUDI-3652 > URL: https://issues.apache.org/jira/browse/HUDI-3652 > Project: Apache Hudi > Issue Type: Improvement > Reporter: hd zhou > Priority: Major > Labels: pull-request-available > > in class ObjectSizeCalculator > everytime call static function getObjectSize will new ObjectSizeCalculator, > cost much memory, Gc busy. use threadlocal will decrease memory use > > {code:java} > /** > * Given an object, returns the total allocated size, in bytes, of the object > and all other objects reachable from it. > * Attempts to to detect the current JVM memory layout, but may fail with > {@link UnsupportedOperationException}; > * > * @param obj the object; can be null. Passing in a {@link java.lang.Class} > object doesn't do anything special, it > * measures the size of all objects reachable through it (which will > include its class loader, and by > * extension, all other Class objects loaded by the same loader, and > all the parent class loaders). It doesn't > * provide the size of the static fields in the JVM class that the > Class object represents. > * @return the total allocated size of the object and all other objects it > retains. > * @throws UnsupportedOperationException if the current vm memory layout > cannot be detected. > */ > public static long getObjectSize(Object obj) throws > UnsupportedOperationException { > return obj == null ? 0 : new > ObjectSizeCalculator(CurrentLayout.SPEC).calculateObjectSize(obj); > } {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)