You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/06/17 04:38:45 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #8846: Reduce the heap memory usage for segment creation

Jackie-Jiang commented on code in PR #8846:
URL: https://github.com/apache/pinot/pull/8846#discussion_r899754796


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/stats/BigDecimalColumnPreIndexStatsCollector.java:
##########
@@ -113,8 +111,11 @@ public int getCardinality() {
 
   @Override
   public void seal() {
-    _sortedValues = _values.toArray(new BigDecimal[0]);
-    Arrays.sort(_sortedValues);
-    _sealed = true;
+    if (!_sealed) {
+      _sortedValues = _values.toArray(new BigDecimal[0]);
+      _values = null;

Review Comment:
   That shouldn't be needed. Once the `_values` is set to `null`, the whole map can be garbage collected. `_values.clear()` will introduce extra overhead, but not reduce the garbage



-- 
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@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org