Skip to content

Commit

Permalink
Test issue #37: Test theory
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuyifei1999 committed Oct 19, 2023
1 parent 4550c3a commit 6c7c84d
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions guppy/heapy/View.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,41 +459,46 @@ def referrers(self, X):
any of the objects in the set X."""

X = self.nodeset_adapt(X)
if self.is_rg_update_all and self.root is self.heapyc.RootState:
if not (self.rg.domain_covers(X) or
self.rg.domain_covers(X - self.norefer)):
self.rg.clear()
import gc
gc.collect()
self.hv.update_referrers_completely(self.rg)
addnoref = X - self.rg.get_domain()
self.norefer |= addnoref
else:
Y = self.mutnodeset(X)
Y -= self.norefer
if not self.rg.domain_covers(Y):
for wt in self.referrers_targets:
t = wt()
if t is not None:
Y |= t.set.nodes
Y |= self.rg.get_domain()
self.rg.clear()
self.hv.update_referrers(self.rg, Y)
self.norefer.clear()
self.norefer |= (X | Y | self.rg.get_range())
self.norefer -= self.rg.get_domain()
Y = self.mutnodeset(X) - self.norefer
if not self.rg.domain_covers(Y):
print('update_referrers failed')
print('Y - domain of rg:')
print(self.idset(Y - self.rg.get_domain()))

Y = None

X = self.rg.relimg(X)
X = self.immnodeset(X) - [None]
X = self.retset(X)
return X
self.referrers_lock += 1
try:
if self.is_rg_update_all and self.root is self.heapyc.RootState:
if not (self.rg.domain_covers(X) or
self.rg.domain_covers(X - self.norefer)):
self.rg.clear()
import gc
gc.collect()
self.hv.update_referrers_completely(self.rg)
addnoref = X - self.rg.get_domain()
self.norefer |= addnoref
else:
Y = self.mutnodeset(X)
Y -= self.norefer
if not self.rg.domain_covers(Y):
for wt in self.referrers_targets:
t = wt()
if t is not None:
Y |= t.set.nodes
Y |= self.rg.get_domain()
self.rg.clear()
self.hv.update_referrers(self.rg, Y)
self.norefer.clear()
self.norefer |= (X | Y | self.rg.get_range())
self.norefer -= self.rg.get_domain()
Y = self.mutnodeset(X) - self.norefer
if not self.rg.domain_covers(Y):
print('update_referrers failed')
print('Y - domain of rg:')
print(self.idset(Y - self.rg.get_domain()))

Y = None

X = self.rg.relimg(X)
X = self.immnodeset(X) - [None]
X = self.retset(X)
return X
finally:
self.referrers_lock -= 1

def referrers_gc(self, X):
"""V.referrers_gc(X) -> idset
Expand Down

0 comments on commit 6c7c84d

Please sign in to comment.