Memory leak on thread removal

Mikolaj Golub to.my.trociny at gmail.com
Sun May 17 08:39:48 UTC 2009


On Tue, 12 May 2009 09:27:30 +0300 Mikolaj Golub wrote:

 MG> Hi,

 MG> The code below is compiled with -fopenmp and run on FreeBSD6/7 (i386, amd64):

 MG> #include <omp.h>
 MG> #include <unistd.h>

 MG> int n = 4, m = 2;

 MG> int main () {
 MG>         for (;;) {
 MG>                 int i;

 MG>                 //sleep(2);
 MG> #pragma omp parallel for num_threads(m)
 MG>                 for(i = 0; i < 1; i++) {}

 MG>                 //sleep(2);
 MG> #pragma omp parallel for num_threads(n)
 MG>                 for(i = 0; i < 1; i++) {}
 MG>                 
 MG>         }

 MG>         return 0;
 MG> }

 MG> During the run the program's virtual memory usage constantly grows. The growth
 MG> is observed only when n != m. When running the program with uncommented
 MG> sleep() and observing the number of threads with 'top -H' I see in turn 2 or 4
 MG> threads. So it looks like memory leak when thread is removed. Should I fill
 MG> PR?

Reported.

http://www.freebsd.org/cgi/query-pr.cgi?pr=134604

-- 
Mikolaj Golub


More information about the freebsd-hackers mailing list