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

Use garbage collection in persistent scheduling #429

Merged
merged 2 commits into from
Jun 22, 2018
Merged

Use garbage collection in persistent scheduling #429

merged 2 commits into from
Jun 22, 2018

Conversation

wlandau
Copy link
Member

@wlandau wlandau commented Jun 22, 2018

Summary

Call gc() on exit for persistent workers and the master process. cc @krlmlr.

Related GitHub issues

Checklist

  • I have read drake's code of conduct, and I agree to follow its rules.
  • I have read the guidelines for contributing.
  • I have listed any substantial changes in the development news.
  • I have added testthat unit tests to tests/testthat to confirm that any new features or functionality work correctly.
  • I have tested this pull request locally with devtools::check()
  • This pull request is ready for review.
  • I think this pull request is ready to merge.

@codecov-io
Copy link

codecov-io commented Jun 22, 2018

Codecov Report

Merging #429 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #429   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          66     66           
  Lines        5362   5363    +1     
=====================================
+ Hits         5362   5363    +1
Impacted Files Coverage Δ
R/mclapply.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 267f3c8...e36f246. Read the comment docs.

R/mclapply.R Outdated
@@ -69,6 +72,7 @@ mc_master <- function(config){
}

mc_worker <- function(worker, config){
on.exit(gc())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we'd substitute Sys.sleep() in line 80 with gc() a few times. (I'm not sure if a second, third ... gc() will free even more memory.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, see e36f246. Re: #422 I thought you might want to keep Sys.sleep(mc_wait) in case gc() is too fast.

@wlandau
Copy link
Member Author

wlandau commented Jun 22, 2018

I think this fixes #428. Merging now. Let's keep discussing.

@wlandau wlandau merged commit e4df333 into master Jun 22, 2018
@wlandau wlandau deleted the gc branch June 22, 2018 20:34
@krlmlr
Copy link
Collaborator

krlmlr commented Jun 22, 2018

Thanks. I'll test the new behavior soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants