Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-6383: [Java] Report outstanding child allocators on close #5227

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ public synchronized void close() {

isClosed = true;

StringBuilder outstandingChildAllocators = new StringBuilder();
if (DEBUG) {
synchronized (DEBUG_LOCK) {
verifyAllocator();
Expand Down Expand Up @@ -445,14 +446,21 @@ public synchronized void close() {
}

}
} else {
if (!childAllocators.isEmpty()) {
outstandingChildAllocators.append("Outstanding child allocators : \n");
for (final BaseAllocator childAllocator : childAllocators.keySet()) {
outstandingChildAllocators.append(String.format(" %s", childAllocator.toString()));
}
}
}

// Is there unaccounted-for outstanding allocation?
final long allocated = getAllocatedMemory();
if (allocated > 0) {
throw new IllegalStateException(
String.format("Memory was leaked by query. Memory leaked: (%d)\n%s", allocated,
toString()));
String.format("Memory was leaked by query. Memory leaked: (%d)\n%s%s", allocated,
outstandingChildAllocators.toString(), toString()));
}

// we need to release our memory to our parent before we tell it we've closed.
Expand Down