#include <omp.h> int n = 4, m = 2; int main () { for (;;) { int i; #pragma omp parallel for num_threads(m) for(i = 0; i < 1; i++) {} #pragma omp parallel for num_threads(n) for(i = 0; i < 1; i++) {} } return 0; } When run on freebsd, this test shows constant growth of virtual memory usage. Memory growth is observed only when m != n. There is some discussion of this problem on freebsd-hackers: http://lists.freebsd.org/pipermail/freebsd-hackers/2009-May/028552.html The problem has also been reported to gcc mainstream: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40174 Fix: The problem is in libgomp/team.c. gomp_thread_start() does sem_init() but sem_destroy() is never called. Attached patch solves the problem for me. Patch attached with submission follows: How-To-Repeat: Compile the test shown above with -fopenmp and run.
Sorry, I have forgotten to mention this. I am running 7.2-STABLE but I think CURRENT is affected too. -- Mikolaj Golub
The developer has pointed out that correct place to call sem_destroy() is on returning from gomp_thread_start(). So the patch for libgomp from RELENG_7 (gcc 4.2.1) would be even simpler then provided previously. -- Mikolaj Golub
State Changed From-To: open->suspended To fix this issue GPL3 licensed code would have to be imported into the FreeBSD source tree, which isn't possible due to licensing issues. Thus suspend this PR for now.
For bugs matching the following conditions: - Status == In Progress - Assignee == "bugs@FreeBSD.org" - Last Modified Year <= 2017 Do - Set Status to "Open"
PR was put in suspended state due to fix requiring GPLv3 code import. Closing it as rejected.
MARKED AS SPAM