Something mysterious is going on with jupyter that I can't yet quite figure out.
Can you work around the problem with
print (soma.psection())
Everytime Jupyter default pretty prints the result of soma.psection(), the hoc reference count of the POINT_PROCESS is incremented
and never gets decremented even with a reset -f Out.
(note: my "jupyter console" even alphabetically sorts the pretty print) e.g.
Code: Select all
hines@hines-T7500:~$ jupyter console
Jupyter console 5.2.0
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
Type "copyright", "credits" or "license" for more information.
IPython 5.5.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from neuron import h
In [2]: soma = h.Section()
In [3]: i = h.IClamp(soma(.5))
In [4]: print (soma.psection())
{'point_processes': {'IClamp': {IClamp[0]}}, 'density_mechs': {}, 'ions': {}, 'morphology': {'L': 100.0, 'diam': [500.0], 'pts3d': [], 'parent': None, 'trueparent': None}, 'nseg': 1, 'Ra': 35.4, 'cm': [1.0], 'regions': set(), 'species': set(), 'name': '__nrnsec_0x4d9af70', 'hoc_internal_name': '__nrnsec_0x4d9af70', 'cell': None}
In [5]: h.allobjects()
IClamp[0] with 1 refs
MechanismType[1] with 1 refs
CVode[0] with 1 refs
Out[5]: 0.0
In [6]: i=None
In [7]: h.allobjects()
MechanismType[1] with 1 refs
CVode[0] with 1 refs
Out[7]: 0.0
In [8]: i = h.IClamp(soma(.5))
In [9]: soma.psection()
Out[9]:
{'Ra': 35.4,
'cell': None,
'cm': [1.0],
'density_mechs': {},
'hoc_internal_name': '__nrnsec_0x4d9af70',
'ions': {},
'morphology': {'L': 100.0,
'diam': [500.0],
'parent': None,
'pts3d': [],
'trueparent': None},
'name': '__nrnsec_0x4d9af70',
'nseg': 1,
'point_processes': {'IClamp': {IClamp[0]}},
'regions': set(),
'species': set()}
In [10]: h.allobjects()
IClamp[0] with 2 refs
MechanismType[3] with 1 refs
CVode[0] with 1 refs
Out[10]: 0.0
In [11]: %reset -f Out
Flushing output cache (4 entries)
In [12]: h.allobjects()
IClamp[0] with 2 refs
MechanismType[3] with 1 refs
CVode[0] with 1 refs
Out[12]: 0.0
In [13]: i=None
In [14]: h.allobjects()
IClamp[0] with 1 refs
MechanismType[3] with 1 refs
CVode[0] with 1 refs
Out[14]: 0.0
In [15]: whos
Variable Type Data/Info
---------------------------------
h HocObject <TopLevelHocInterpreter>
i NoneType None
soma Section __nrnsec_0x4d9af70
In [16]: