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.

Title: Multiple Python Interpreter Memory Leak
Type: resource usage Stage: needs patch
Components: Interpreter Core, Windows Versions: Python 2.6
Status: closed Resolution: duplicate
Dependencies: Superseder: Py_Finalize() doesn't clear all Python objects at exit
View: 1635741
Assigned To: Nosy List: amaury.forgeotdarc, brian.curtin, ewillie007, tim.golden
Priority: normal Keywords:

Created on 2010-03-29 10:08 by ewillie007, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
PythonCall.cpp ewillie007, 2010-03-29 10:08 C++ Source file developed in Visual Studio 6.0 to demonstrate the python interpreter memory leak problem.
Messages (2)
msg101885 - (view) Author: William (ewillie007) Date: 2010-03-29 10:08
I am embedding Python into a Windows based C++ application, where a new Python interpreter (using Py_NewInterpreter) is created for each user who connects to the system. When the user logs off, the function "Py_EndInterpreter" is used to free all the associated resources.

After starting the application on a server, the memory usage increases rapidly as some users login and log-off from the system.

Some Tests:
I have conducted some tests along with the Python interpreter. I have written a simple C++ program which simply creates 100 Python interpreters and then ends them one by one. If we check the Windows Task Manager, the following are the observations:-

Memory usage before starting to create the Python Interpreters: 4316K
Memory usage after creating 100 Python Interpreters: 61248K
Memory usage after ending the 100 Python Interpreters: 47664K

This shows that there has been a memory leak of approximately 43348K

Please do consider this problem for fixing at the earliest or let me know if I am doing something wrong.
msg111034 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-07-21 10:21
It's actually the same issue as issue1635741
Date User Action Args
2022-04-11 14:56:59adminsetgithub: 52505
2010-07-21 10:21:13amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg111034

superseder: Py_Finalize() doesn't clear all Python objects at exit
resolution: duplicate
2010-07-20 18:00:56BreamoreBoysetnosy: + tim.golden, brian.curtin

stage: needs patch
2010-03-29 10:08:11ewillie007create