BewareMyPower commented on code in PR #23833:
URL: https://github.com/apache/pulsar/pull/23833#discussion_r1914279146


##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/BitSetRecyclable.java:
##########
@@ -1211,6 +1211,9 @@ public void recycle() {
         if (recyclerHandle != null) {
             this.clear();
             recyclerHandle.recycle(this);
+            // Reset with null so that recycle() can be called many times but 
only the 1st time takes effect.

Review Comment:
   Yes, it's hardly to see two `BitSetRecyclable` objects share the same 
underlying long array (`ackSet`). In this case, even if two allocations of 
`BitSetRecyclable` share the same slot in the recycler's local pool 
(`Recycler#threadLocal`), the long array is still allocated twice from JVM heap 
memory, which should take the majority of the memory.
   
   ----
   
   The change is done, PTAL again @dao-jun 



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

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

Reply via email to