Forráskód Böngészése

src/core: free allocated memory

Nathalie Furmento 14 éve
szülő
commit
c4cda5056b
2 módosított fájl, 14 hozzáadás és 3 törlés
  1. 10 0
      src/core/topology.c
  2. 4 3
      src/datawizard/filters.c

+ 10 - 0
src/core/topology.c

@@ -770,6 +770,16 @@ void _starpu_destroy_topology(struct starpu_machine_config_s *config __attribute
 	/* cleanup StarPU internal data structures */
 	_starpu_deinit_memory_nodes();
 
+	unsigned worker;
+	for (worker = 0; worker < config->topology.nworkers; worker++)
+	{
+#ifdef STARPU_HAVE_HWLOC
+		struct starpu_worker_s *workerarg = &config->workers[worker];
+		hwloc_bitmap_free(workerarg->initial_hwloc_cpu_set);
+		hwloc_bitmap_free(workerarg->current_hwloc_cpu_set);
+#endif
+	}
+
 #ifdef STARPU_HAVE_HWLOC
 	hwloc_topology_destroy(config->topology.hwtopology);
 #endif

+ 4 - 3
src/datawizard/filters.c

@@ -143,6 +143,7 @@ void starpu_data_partition(starpu_data_handle initial_handle, struct starpu_data
 		child->req_list = starpu_data_requester_list_new();
 		child->reduction_req_list = starpu_data_requester_list_new();
 		child->refcnt = 0;
+		child->reduction_refcnt = 0;
 		_starpu_spin_init(&child->header_lock);
 
 		child->sequential_consistency = initial_handle->sequential_consistency;
@@ -159,9 +160,6 @@ void starpu_data_partition(starpu_data_handle initial_handle, struct starpu_data
 		child->redux_cl = initial_handle->redux_cl;
 		child->init_cl = initial_handle->init_cl;
 
-		child->reduction_refcnt = 0;
-		child->reduction_req_list = starpu_data_requester_list_new();
-
 #ifdef STARPU_USE_FXT
 		child->last_submitted_ghost_writer_id_is_valid = 0;
 		child->last_submitted_ghost_writer_id = 0;
@@ -257,6 +255,8 @@ void starpu_data_unpartition(starpu_data_handle root_handle, uint32_t gathering_
 		STARPU_ASSERT(ret == 0); 
 
 		_starpu_data_free_interfaces(&root_handle->children[child]);
+		starpu_data_requester_list_delete(child_handle->req_list);
+		starpu_data_requester_list_delete(child_handle->reduction_req_list);
 	}
 
 	/* the gathering_node should now have a valid copy of all the children.
@@ -315,6 +315,7 @@ void starpu_data_unpartition(starpu_data_handle root_handle, uint32_t gathering_
 	}
 
 	/* there is no child anymore */
+	free(root_handle->children);
 	root_handle->nchildren = 0;
 
 	/* now the parent may be used again so we release the lock */