davisusanibar commented on code in PR #35314: URL: https://github.com/apache/arrow/pull/35314#discussion_r1228471565
########## java/memory/memory-netty/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java: ########## @@ -1091,6 +1099,43 @@ public void testMemoryLeakWithReservation() throws Exception { } } + @Test + public void testMemoryUsage() { + ListAppender<ILoggingEvent> memoryLogsAppender = new ListAppender<>(); + Logger logger = (Logger) LoggerFactory.getLogger("arrow.allocator"); + try { + logger.setLevel(Level.TRACE); + logger.addAppender(memoryLogsAppender); + memoryLogsAppender.start(); + try (ArrowBuf buf = new ArrowBuf(ReferenceManager.NO_OP, null, + 1024, new PooledByteBufAllocatorL().empty.memoryAddress())) { + buf.memoryAddress(); + } + BiFunction<List<String>, Level, Boolean> listAppenderContains = + (List<String> values, Level level) -> memoryLogsAppender.list.stream() + .anyMatch( + log -> log.toString().contains(values.get(0)) && + log.toString().contains(values.get(1)) && + log.toString().contains(values.get(2)) && + log.getLevel().equals(level) + ); + boolean result = false; + long startTime = System.currentTimeMillis(); + while (true && (System.currentTimeMillis() - startTime) < 20000) { + result = listAppenderContains.apply(Arrays.asList("Memory Usage: \n", "Large buffers outstanding: ", Review Comment: Changed -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org