[OG9, amdgcn, committed] Fix memory leak in libgomp

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[OG9, amdgcn, committed] Fix memory leak in libgomp

Andrew Stubbs-4
Committed to OG9 on behalf of Kwok ...

The list of struct gomp_threads allocated in gomp_gcn_enter_kernel was
not being freed in gomp_gcn_exit_kernel, leading to a small memory leak
every time a kernel is run. Runs with a lot of teams or many kernels
were running out of heap space.


Fix memory leak in libgomp when using OpenMP

2019-09-10  Kwok Cheung Yeung  <[hidden email]>

        * config/gcn/team.c (gomp_gcn_exit_kernel): Free GCN thread list.

diff --git a/libgomp/config/gcn/team.c b/libgomp/config/gcn/team.c
index 79aec65a24e..534cf595c98 100644
--- a/libgomp/config/gcn/team.c
+++ b/libgomp/config/gcn/team.c
@@ -93,6 +93,7 @@ void
 gomp_gcn_exit_kernel (void)
   gomp_free_thread (gcn_thrs ());
+  free (gcn_thrs ());
 /* This function contains the idle loop in which a thread waits