From 9d1d0c52e4e0163469501e8c377c8e7b16c1d07d Mon Sep 17 00:00:00 2001 From: maksymis <32574056+maksymiuks@users.noreply.github.com> Date: Thu, 26 Sep 2024 12:11:01 +0200 Subject: [PATCH 1/3] Test gc usage --- R/check_design.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/check_design.R b/R/check_design.R index fee59c9..d89a92e 100644 --- a/R/check_design.R +++ b/R/check_design.R @@ -161,6 +161,8 @@ check_design <- R6::R6Class( # nolint cyclocomp_linter if (self$is_done()) { return(-1L) + } else { + gc(FALSE, FALSE, TRUE) } # if all available processes are in use, terminate early From 3cf698df361f8054f25441fd7c24c5418813b7f2 Mon Sep 17 00:00:00 2001 From: maksymis <32574056+maksymiuks@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:52:49 +0200 Subject: [PATCH 2/3] Force garbage collection --- DESCRIPTION | 2 +- NEWS.md | 3 +++ R/check_design.R | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4bca9db..81122aa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: checked Title: Systematically Run R CMD Checks -Version: 0.2.3.9004 +Version: 0.2.3.9005 Authors@R: c( person( diff --git a/NEWS.md b/NEWS.md index b327284..5294140 100644 --- a/NEWS.md +++ b/NEWS.md @@ -21,6 +21,9 @@ * Prettify output by stripping excessive new lines. +* Force garbage collection before scheduling task, to make sure any already + finished processes are removed from the memory. + # checked 0.2.3 * Use custom `checked` `finisher`'s instead of the `processx` `finalizer`'s diff --git a/R/check_design.R b/R/check_design.R index d89a92e..848acf8 100644 --- a/R/check_design.R +++ b/R/check_design.R @@ -162,7 +162,9 @@ check_design <- R6::R6Class( # nolint cyclocomp_linter if (self$is_done()) { return(-1L) } else { - gc(FALSE, FALSE, TRUE) + # Force garbage collection to make sure memory used by any processes + # that have already finished is freed. + gc(verbose = FALSE, reset = FALSE, full = TRUE) } # if all available processes are in use, terminate early From 48cd7c1defe57f95fee27730efefd6efac9462b6 Mon Sep 17 00:00:00 2001 From: Szymon Maksymiuk <32574056+maksymiuks@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:50:33 +0200 Subject: [PATCH 3/3] Update R/check_design.R Co-authored-by: dgkf-roche <91694157+dgkf-roche@users.noreply.github.com> --- R/check_design.R | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/R/check_design.R b/R/check_design.R index 848acf8..222cb3e 100644 --- a/R/check_design.R +++ b/R/check_design.R @@ -161,11 +161,10 @@ check_design <- R6::R6Class( # nolint cyclocomp_linter if (self$is_done()) { return(-1L) - } else { - # Force garbage collection to make sure memory used by any processes - # that have already finished is freed. - gc(verbose = FALSE, reset = FALSE, full = TRUE) } + + # force garbage collection to free memory from terminated processes + gc(verbose = FALSE, reset = FALSE, full = TRUE) # if all available processes are in use, terminate early n_active <- length(private$active)