Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions r/R/arrow-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
invisible()
}

.onUnload <- function(...) {
# When running valgrind we need to wait for the thread pools to finish
# running background tasks or else spurious memory leaks may be reported.
if (on_linux_dev()) {
WaitForIdleThreadPool()
}
}

configure_tzdb <- function() {
# This is needed on Windows to support timezone-aware calculations
if (requireNamespace("tzdb", quietly = TRUE)) {
Expand Down
4 changes: 4 additions & 0 deletions r/R/arrowExports.R

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions r/src/arrowExports.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions r/src/threadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,17 @@ int GetIOThreadPoolCapacity() { return arrow::io::GetIOThreadPoolCapacity(); }
void SetIOThreadPoolCapacity(int threads) {
StopIfNotOk(arrow::io::SetIOThreadPoolCapacity(threads));
}

namespace arrow {
namespace io {
namespace internal {
arrow::internal::ThreadPool* GetIOThreadPool();
}
} // namespace io
} // namespace arrow

// [[arrow::export]]
void WaitForIdleThreadPool() {
arrow::internal::GetCpuThreadPool()->WaitForIdle();
arrow::io::internal::GetIOThreadPool()->WaitForIdle();
}