Skip to content

Commit

Permalink
Debugging suspected memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
InnovativeInventor committed Jan 19, 2022
1 parent 1f15c1d commit 405cb4a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gerrychain/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@ def __init__(self, graph: Graph, pygraph: retworkx.PyGraph = None, mappings: Tup
def __len__(self):
return len(self.graph)

# @functools.cache # memory leak
# @functools.cache # memory leak?
def __getattribute__(self, __name: str) -> Any:
try:
return object.__getattribute__(self, __name)
except AttributeError:
return object.__getattribute__(self.graph, __name)

@functools.cache
# @functools.cache # memory leak?
def __getitem__(self, __name: str) -> Any:
return self.graph[__name]

Expand Down Expand Up @@ -406,7 +406,7 @@ def edge_indicies(self):
def degree(self, n):
return self.graph.degree(n)

@functools.cache
# @functools.cache
def lookup(self, node, field):
return self.graph.nodes[node][field]

Expand All @@ -418,7 +418,7 @@ def subgraph(self, nodes):
)
)

@functools.cache
# @functools.cache
def pygraph_pop_lookup(self, field: str):
attrs = [0] * len(self.pygraph.node_indexes())
for node in self.pygraph.node_indexes():
Expand Down

0 comments on commit 405cb4a

Please sign in to comment.