You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "waitinfuture (via GitHub)" <gi...@apache.org> on 2023/05/17 07:22:16 UTC

[GitHub] [incubator-celeborn] waitinfuture commented on a diff in pull request #1490: [CELEBORN-583] Merge pooled memory allocators.

waitinfuture commented on code in PR #1490:
URL: https://github.com/apache/incubator-celeborn/pull/1490#discussion_r1196045646


##########
common/src/main/java/org/apache/celeborn/common/network/util/NettyUtils.java:
##########
@@ -106,4 +110,18 @@ public static PooledByteBufAllocator createPooledByteBufAllocator(
         allowCache ? PooledByteBufAllocator.defaultNormalCacheSize() : 0,
         allowCache ? PooledByteBufAllocator.defaultUseCacheForAllThreads() : false);
   }
+
+  public static PooledByteBufAllocator getShardPooledByteBufAllocator(
+      CelebornConf conf, AbstractSource source) {
+    synchronized (PooledByteBufAllocator.class) {
+      if (_allocator == null) {
+        // each core should have one arena to allocate memory
+        _allocator = createPooledByteBufAllocator(true, true, conf.allocatorArenas());
+        new NettyMemoryMetrics(_allocator, "common-pool", conf.allocatorVerboseMetric(), source);
+        return _allocator;

Review Comment:
   We can remove the else branch by moving ```return _allocator;``` out of the if block. IDE says.



-- 
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: issues-unsubscribe@celeborn.apache.org

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