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

Message ID 7e8ff8ab-6918-ae65-c59f-b30103506185@codesourcery.com
State New
Headers show
  • [OG9,amdgcn,committed] Fix memory leak in libgomp
Related show

Commit Message

Andrew Stubbs Sept. 10, 2019, 1:55 p.m.
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  <kcy@codesourcery.com>

	* 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