r268237 - in /trunk/libgomp: ChangeLog plugin/p...

vries@gcc.gnu.org vries@gcc.gnu.org
Thu Jan 24 14:12:00 GMT 2019


Author: vries
Date: Thu Jan 24 14:12:19 2019
New Revision: 268237

URL: https://gcc.gnu.org/viewcvs?rev=268237&root=gcc&view=rev
Log:
[nvptx, libgomp] Fix memleak in GOMP_OFFLOAD_fini_device

I wrote a test-case:
...
int
main (void)
{
  for (unsigned i = 0; i < 128; ++i)
    {
      acc_init (acc_device_nvidia);
      acc_shutdown (acc_device_nvidia);
    }

  return 0;
}
...
and ran it under valgrind.  The only leak location reported with a frequency
of 128, was the allocation of ptx_devices in nvptx_init.

Fix this by freeing ptx_devices in GOMP_OFFLOAD_fini_device, once
instantiated_devices drops to 0.

2019-01-24  Tom de Vries  <tdevries@suse.de>

	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_fini_device): Free ptx_devices
	once instantiated_devices drops to 0.

Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/plugin/plugin-nvptx.c



More information about the Gcc-cvs mailing list