Jackie-Jiang commented on code in PR #12808: URL: https://github.com/apache/pinot/pull/12808#discussion_r1559871148
########## pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/memory/unsafe/DirectMemory.java: ########## @@ -56,8 +56,12 @@ public void flush() { @Override public synchronized void close() { if (!_closed) { - Unsafer.UNSAFE.freeMemory(_address); - _closed = true; + synchronized (this) { Review Comment: This method is almost always invoked only once, so the double-checked locking is not helping much here. Even for singleton class access, I've read that for modern JVM the overhead of locking is negligible, and people are suggesting using global locking for simplicity -- 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