This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Andrew
Fix memory leak in libgomp when using OpenMP

2019-09-10  Kwok Cheung Yeung  <kcy@codesourcery.com>

	libgomp/
	* 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]