fix gc
This commit is contained in:
@ -1,12 +1,14 @@
|
||||
def mark(w_context):
|
||||
if w_context.mark: # skip cycles
|
||||
return
|
||||
|
||||
w_context.mark = True
|
||||
|
||||
if not hasattr(w_context, "slots"): # skip primitive objects
|
||||
return
|
||||
|
||||
for name, obj in w_context.slots.items():
|
||||
if name != "__parent__": # only descent
|
||||
mark(obj)
|
||||
mark(obj)
|
||||
|
||||
|
||||
def sweep(objects):
|
||||
|
@ -44,7 +44,8 @@ class ObjectSpace(object):
|
||||
else:
|
||||
slots = {'__parent__': self.getbuiltins()}
|
||||
|
||||
return W_NormalObject(name=name, slots=slots) # lobby isn't collected
|
||||
self.objects.append(W_NormalObject(name=name, slots=slots)) # needed, otherwise marking skips the root
|
||||
return self.objects[-1]
|
||||
|
||||
def newobject(self, name, slots, parentnames):
|
||||
self.objects.append(W_NormalObject(space=self, name=name,
|
||||
|
Reference in New Issue
Block a user