You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import gc
import pymc
gc.collect()
foo= pymc.Bernoulli('foo', .3, value=[1])
model = pymc.Model([foo])
mcmc = pymc.MCMC(model)
mcmc.sample(10000, 2000, progress_bar=False)
obj = id(mcmc)
del foo
del model
del mcmc
gc.collect()
for o in gc.get_objects():
if obj == id(o):
print 'mcmc still exists'
The sample function attaches traces which introduces a circular reference means these object rely on gc to be freed. Unfortunately a numpy.array is part of the circular reference, so we are hitting this issue.
The text was updated successfully, but these errors were encountered:
I just tested with python 3.6.3 on macOS. The output was "mcmc still exists" meaning that the object was not garbage collected even though all local references foo, model, and mcmc have been deleted.
The sample function attaches traces which introduces a circular reference means these object rely on gc to be freed. Unfortunately a numpy.array is part of the circular reference, so we are hitting this issue.
The text was updated successfully, but these errors were encountered: