[entropy.graph] Graph: drop __del__ (just use destroy() instead) to help automatic GC
This commit is contained in:
@@ -849,7 +849,6 @@ def _revgraph_package(entropy_client, installed_pkg_id, package, dbconn,
|
||||
|
||||
del stack
|
||||
graph.destroy()
|
||||
del graph
|
||||
return 0
|
||||
|
||||
def graph_packages(packages, entropy_client, complete = False,
|
||||
@@ -947,7 +946,6 @@ def _graph_package(match, package, entropy_intf, show_complete = False,
|
||||
|
||||
del stack
|
||||
graph.destroy()
|
||||
del graph
|
||||
return 0
|
||||
|
||||
def _graph_to_stdout(entropy_client, graph, start_item,
|
||||
|
||||
@@ -1840,7 +1840,6 @@ class CalculatorsMixin:
|
||||
|
||||
if deps_not_found:
|
||||
graph.destroy()
|
||||
del graph
|
||||
raise DependenciesNotFound(deps_not_found)
|
||||
|
||||
# get adjacency map before it gets destroyed by solve()
|
||||
@@ -1850,7 +1849,6 @@ class CalculatorsMixin:
|
||||
deptree = graph.solve()
|
||||
if 0 in deptree:
|
||||
graph.destroy()
|
||||
del graph
|
||||
raise KeyError("Graph contains a dep_level == 0")
|
||||
|
||||
# now check and report dependencies with colliding scope and in case,
|
||||
@@ -1865,7 +1863,6 @@ class CalculatorsMixin:
|
||||
len(x) > 1]
|
||||
if _colliding_deps:
|
||||
graph.destroy()
|
||||
del graph
|
||||
raise DependenciesCollision(_colliding_deps)
|
||||
|
||||
# now use the ASAP herustic to anticipate post-dependencies
|
||||
@@ -1887,7 +1884,6 @@ class CalculatorsMixin:
|
||||
reverse_tree[level_count] = deptree[key]
|
||||
|
||||
graph.destroy()
|
||||
del graph
|
||||
reverse_tree[0] = deptree_conflicts
|
||||
|
||||
if self.xcache:
|
||||
@@ -2345,7 +2341,6 @@ class CalculatorsMixin:
|
||||
del flat_dep_tree
|
||||
|
||||
graph.destroy()
|
||||
del graph
|
||||
|
||||
if self.xcache:
|
||||
self._cacher.push(c_hash, deptree)
|
||||
|
||||
@@ -35,12 +35,6 @@ class GraphNode(object):
|
||||
self.__item = item
|
||||
self.__arches = set()
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
self._clear()
|
||||
except (NameError, AttributeError):
|
||||
pass
|
||||
|
||||
def _clear(self):
|
||||
"""
|
||||
Clear the object
|
||||
@@ -154,12 +148,6 @@ class GraphArchSet(object):
|
||||
self.__origin = starting_point
|
||||
self.__endpoints = set()
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
self._clear()
|
||||
except (NameError, AttributeError):
|
||||
pass
|
||||
|
||||
def _clear(self):
|
||||
"""
|
||||
Cleanup the object
|
||||
@@ -245,16 +233,6 @@ class TopologicalSorter(object):
|
||||
self.__adjacency_map = adjacency_map
|
||||
self.__stack = Lifo()
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
self.__adjacency_map.clear()
|
||||
except (NameError, AttributeError):
|
||||
pass
|
||||
try:
|
||||
self.__stack.clear()
|
||||
except (NameError, AttributeError):
|
||||
pass
|
||||
|
||||
def __topological_sort_visit_node(self, node, low, result):
|
||||
"""
|
||||
Internal method, visits a node ad push to stack.
|
||||
@@ -385,12 +363,6 @@ class Graph(object):
|
||||
self.__archs_map = {}
|
||||
self.__graph_map_cache = None
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
self.destroy()
|
||||
except (AttributeError, NameError):
|
||||
pass
|
||||
|
||||
def destroy(self):
|
||||
"""
|
||||
Cleanup any reference.
|
||||
|
||||
Reference in New Issue
Block a user