2
int main() {
  #pragma omp parallel for
  for (int i = 0; i < 1000; i = i + 1) {
    std::cout << "some";
  }
  //other code
}

Valgrind report:

possibly lost: 2,128 bytes in 7 blocks

If I omit the "other code" in the example above everything works fine. Unfortunately I can not share the code. Is there maybe a common pattern for why this can happen? Note that in the "other code" no parallelism is involved.

Nb: I also tried something else in the loop than cout and it was the same issue.

EDIT: Maybe it goes without saying but to make sure: Dropping #pragma omp parallel for results in a report without any leaks.

ben
  • 5,131
  • 4
  • 25
  • 54

0 Answers0