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

memory leak with coforall reducing an array #13569

Closed
mppf opened this issue Jul 29, 2019 · 1 comment · Fixed by #13604
Closed

memory leak with coforall reducing an array #13569

mppf opened this issue Jul 29, 2019 · 1 comment · Fixed by #13604

Comments

@mppf
Copy link
Member

mppf commented Jul 29, 2019

The following program leaks memory:

config const n = 100;
  
proc main() {
  var counts:[0..#n] int;
  var nTasks = 10;
  coforall tid in 0..#nTasks with (+ reduce counts) {
    counts[tid] += 1;
  }
}

This caused an increase in memory leaks in nightly:

https://chapel-lang.org/perf/chapcs/?startdate=2019/07/14&enddate=2019/07/28&graphs=memoryleaksforalltests

from the test test/library/packages/Sort/correctness/test-radix-bucketizer.chpl which calls SequentialInPlacePartitioning.bucketize which uses this pattern. (These were added in PR #13347).

@bradcray
Copy link
Member

Thanks for picking this up, Vass.

@vasslitvinov vasslitvinov added this to the PB Sprint 35 milestone Jul 30, 2019
vasslitvinov added a commit to vasslitvinov/chapel that referenced this issue Aug 1, 2019
Resolves chapel-lang#13569

When setting up the AST for a task reduce intent, I was using
PRIM_ASSIGN instead of calling the `=` function (which is a really bad
idea when used on an array btw) to store the result of globalOp.generate()
into the outer variable.  Also, the task-private shadow variables were not
getting autoDestroy-ed. This fixes these bugs.
vasslitvinov added a commit that referenced this issue Aug 1, 2019
Fix memory leaks in test-radix-bucketizer.chpl

Resolves #13569, plugging the memory leak in

    test/library/packages/Sort/correctness/test-radix-bucketizer.chpl

When setting up the AST for a task reduce intent, I was using
PRIM_ASSIGN instead of calling the `=` function (which is a really bad
idea when used on an array btw) to store the result of globalOp.generate()
into the outer variable.  Also, the task-private shadow variables were not
getting autoDestroy-ed. This fixes these bugs.

While there, add multi-arg versions of `Expr::insertAfter(Expr*)`, for convenience.
A single varargs version instead would be even nicer.

r: @mppf
vasslitvinov added a commit to vasslitvinov/chapel that referenced this issue Aug 2, 2019
vasslitvinov added a commit that referenced this issue Aug 2, 2019
Add a reproducer for #13569

While #13569 was fixed in #13604, we would like to have a dedicated
small reproducer to ensure that the issue stays in check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants