gortiz commented on PR #10528:
URL: https://github.com/apache/pinot/pull/10528#issuecomment-1572200315

   I've decided to remove the `finalize` from `PinotDataBuffer` because it 
doesn't seem trivial to keep track on whether we actually need to release the 
memory or not, given that we may have other views that actually use the 
resource. 
   
   We have to remember that the release-when-gc is just a protection we have 
against some leak in the code. We should always close the buffers explicitly in 
order to make sure we use the smallest possible amount of memory. In case we 
forget to close a buffer:
   - The ones backed by ByteBuffers should be eventually collected by the GC, 
but it is not guaranteed. It is not uncommon to have situations when these are 
never collected, specially when the bytebuffer reference is in the old 
generation.
   - With LArray, unless the library has its own protection, they will be 
leaked for the whole JVM lifetime.
   - With Unsafe, each buffer has a reference to a Memory object. These Memory 
objects override finalize, we should have the same protection than with 
ByteBuffers.
   
   We have to remember that `finalize` is marker as deprecated to be removed in 
the JVM and it is not guaranteed that this method is going to be called.


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

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


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

Reply via email to