adamkennedy opened a new issue, #34338: URL: https://github.com/apache/arrow/issues/34338
### Describe the bug, including details regarding any error messages, version, and platform. BaseAllocator.DEBUG is currently enabled automatically any time assertions are enabled via -ea which is typically all test runs and JUnit usages in IDEs, including debugging and profiling based on JUnit tests. The problem with this is that BaseAllocator.DEBUG causes ArrowBuf to maintain a HistoricalLog with 5 history entries. To achieve this, a highly expensive event containing a full stack trace must be created for each allocation event with the vast majority of them thrown away. For example: In an application that generates many small (100kB) Arrow data frames, each consisting of around 50 vectors, profiling parts of the test suite related to Arrow generation shows that the creation the StackTrace instances needed for the rolling 5 entry HistoricalLog consume 85% of all program CPU and are responsible for 80% of all Java memory allocation. During the applications full Maven test run, which is not a debugging scenario but sees BaseAllocator.DEBUG turned on anyway due to -ea, the cost of HistoricalLog increases the total test run-time from 4 seconds (with arrow.memory.debug.allocator=false ) to 14 seconds, a substantial slow-down for no real value and a large cost when spread over every test and CI run. Profiling also becomes challenging, because the cost of StackTrace spread out across the program pollutes and distorts profiling results and flame graphs become largely unusable. These negative effects occur in every Arrow Java application by default, unless explicitly turned off. I propose that the default of arrow.memory.debug.allocator be reversed to false by removing the automatic enabling of BaseAllocator.DEBUG on -ea. If this is not acceptable, then at minimum the maintenance of HistoricalLog should be separately and specifically disabled. In debugging or diagnostic messages, in place of the information presented from HistoricalLog we could instead place a message saying that HistoricalLog is disabled and describing the system property needed to enable it. ### Component(s) Java -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
