Memory leak in PyImport_ReloadModule - URGENT

ben.held at staarinc.com ben.held at staarinc.com
Wed Aug 10 12:22:47 EDT 2005


Having recently upgraded to Python 2.4, I am having a large memory
leak with the following code built with VC++ 6.0:

		PyObject *pName, *pModule;

		Py_Initialize();
		pName = PyString_FromString(argv[1]);

		pModule = PyImport_Import(pName);
		Py_DECREF(pName);

		PyObject* pModule2 = PyImport_ReloadModule(pModule);
		Py_DECREF(pModule2);
		Py_DECREF(pModule);
		Py_Finalize();
		return 0;

I get leaks of over 500 kb.  I have another program which is much more
complex, in which every call to PyImport_ReloadModule is leaking 200+
kb, even though I am calling Py_DECREF correctly.

Help!




More information about the Python-list mailing list