samueldlightfoot commented on code in PR #4179: URL: https://github.com/apache/cassandra/pull/4179#discussion_r2106250693
########## src/java/org/apache/cassandra/io/util/FileUtils.java: ########## @@ -360,30 +325,7 @@ public static boolean isContained(File folder, File file) public static void clean(ByteBuffer buffer) { - if (buffer == null || !buffer.isDirect()) - return; - - // TODO Once we can get rid of Java 8, it's simpler to call sun.misc.Unsafe.invokeCleaner(ByteBuffer), - // but need to take care of the attachment handling (i.e. whether 'buf' is a duplicate or slice) - that - // is different in sun.misc.Unsafe.invokeCleaner and this implementation. - - try - { - Object cleaner = mhDirectBufferCleaner.bindTo(buffer).invoke(); - if (cleaner != null) - { - // ((DirectBuffer) buf).cleaner().clean(); - mhCleanerClean.bindTo(cleaner).invoke(); - } - } - catch (RuntimeException e) - { - throw e; - } - catch (Throwable e) - { - throw new RuntimeException(e); - } + MemoryUtil.clean(buffer); Review Comment: We can inline this to call MemoryUtil, but there are 42 usages (or alternative move theUnsafe into here). -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org