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
The leak comes from the following lines of _PySys_EndInit():
---
PyObject*warnoptions=get_warnoptions();
if (warnoptions==NULL)
return-1;
SET_SYS_FROM_STRING_BORROW_INT_RESULT("warnoptions", warnoptions);
PyObject*xoptions=get_xoptions();
if (xoptions==NULL)
return-1;
SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", xoptions);
It's not the first time that I have an issue with these attributes. The last reference weak caused by multiple interpreters was also related to this one if I recall correctly.
Extract of my msg295399: "The problem is that warnoptions is stored in a C global variable *and* in sys.warnoptions of each interpreter. The ownership of this variable is unclear."
Maybe we need a change similar to bpo-28411 (commit 86b7afd) which removed the "modules" field from Py_InterpreterState.
Moving warnoptions (and xoptions) out of PyInterpreterState seems like a good idea to me for the same reasons as applied to sys.modules. The case for these two is even stronger since they are only used in sysmodule.c.
Activity
vstinner commentedon Sep 11, 2017
The following commands show memory leaks introduced by bpo-30860:
vstinner commentedon Sep 11, 2017
Oh, I'm talking about the commit 2ebc5ce.
skrah commentedon Sep 11, 2017
Could be the same as bpo-31408.
vstinner commentedon Sep 11, 2017
The leak comes from the following lines of _PySys_EndInit():
---
It's not the first time that I have an issue with these attributes. The last reference weak caused by multiple interpreters was also related to this one if I recall correctly.
See bpo-30598 and my commit 865de27.
vstinner commentedon Sep 11, 2017
Extract of my msg295399: "The problem is that warnoptions is stored in a C global variable *and* in sys.warnoptions of each interpreter. The ownership of this variable is unclear."
Maybe we need a change similar to bpo-28411 (commit 86b7afd) which removed the "modules" field from Py_InterpreterState.
ericsnowcurrently commentedon Sep 11, 2017
I'm looking into this.
ericsnowcurrently commentedon Sep 11, 2017
Moving warnoptions (and xoptions) out of PyInterpreterState seems like a good idea to me for the same reasons as applied to sys.modules. The case for these two is even stronger since they are only used in sysmodule.c.
ericsnowcurrently commentedon Sep 14, 2017
New changeset dae0276 by Eric Snow in branch 'master':
bpo-30860: Fix a refleak. (bpo-3567)
dae0276