This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Memory leak creating sub-interpreters
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: amaury.forgeotdarc, barry, jslaughter
Priority: normal Keywords:

Created on 2000-11-17 12:42 by jslaughter, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (3)
msg2433 - (view) Author: James Slaughter (jslaughter) Date: 2000-11-17 12:42
Instantiating a sub-interpreter in Python 2.0 (compiled with Visual C++ 6 SP4) allocates memory that is never released. The problem can be reproduced using the following sample code:

/* For unmodified Python 2.0 (#8, Oct 16 2000, 17:27:58) */
#include "Python.H"

int main()
{
  Py_Initialize();
  PyEval_InitThreads();
  PyThreadState* mainThread = PyEval_SaveThread();
  for (;;)
  {
    PyEval_AcquireLock();
    Py_EndInterpreter(Py_NewInterpreter());
    PyEval_ReleaseLock();
  }
  PyEval_AcquireThread(mainThread);
  Py_Finalize();
  return 0;
}
msg2434 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2000-12-11 22:55
Fixed with the com_import_stmt() patch for leaks associated with "from foo import blah".
msg133296 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-04-08 07:16
For the record, the changeset was 433458651eb4
History
Date User Action Args
2022-04-10 16:03:30adminsetgithub: 33488
2011-04-08 07:16:48amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg133296
2000-11-17 12:42:58jslaughtercreate