GregBowyer commented on a change in pull request #8698:
URL: https://github.com/apache/arrow/pull/8698#discussion_r534658141



##########
File path: rust/parquet/src/util/memory.rs
##########
@@ -383,12 +383,10 @@ impl<T: Debug> Display for BufferPtr<T> {
 
 impl<T> Drop for BufferPtr<T> {
     fn drop(&mut self) {
-        if self.is_mem_tracked()
-            && Arc::strong_count(&self.data) == 1
-            && Arc::weak_count(&self.data) == 0
-        {
-            let mc = self.mem_tracker.as_ref().unwrap();
-            mc.alloc(-(self.data.capacity() as i64));
+        if let Some(ref mc) = self.mem_tracker {

Review comment:
       Performance Notes:
   
   This construction reduces the cost of the branch a little by avoiding 
checking ref counts if we are not tracking memory sizes.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to