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

Remove goroutines from Minimize to prevent goroutine leaks #19

Closed
3 tasks done
wkschwartz opened this issue Sep 28, 2016 · 0 comments
Closed
3 tasks done

Remove goroutines from Minimize to prevent goroutine leaks #19

wkschwartz opened this issue Sep 28, 2016 · 0 comments
Assignees
Milestone

Comments

@wkschwartz
Copy link
Owner

wkschwartz commented Sep 28, 2016

When testing bc8afe7 I noticed that the tests were creating and leaking thousands of goroutines, even though Pigosat as a whole uses very few go calls. I tracked it down to this: newMinimizer creates args as m.args = make(chan arguments, 2). I think the channel fills up and goroutines are blocking on send to the channel.

Maybe this is a more general problem. Using a go call in Minimize is a bit overkill. Instead of adding a Join or Wait method to the Minimizer interface that blocks until all calls to RecordSolution have completed and having Minimize call it before returning, just don't use goroutines at all. Generally, RecordSolution will do nothing more than append to a slice or write to a channel. This is not the real speed bottleneck in the code.

  • Remove use of go in Minimize
  • Remove requirement that RecordSolution be safe for parallel use
  • Replace use of channels in optimize_test with simple slices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant