471,873 Members | 1,088 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

Is there a memory leakage in this embedded python code?

Hi All,
I am working on embedded python on C these days. I feel there is a
memory leakage in this code. I have used our own memory pool and all
the python code will use the heap from this memory pool.
RunScript(pScriptName,pFuncName,...)
{
PyEval_AcquireLock()
threadState = Py_NewInterpreter();
PyThreadState_Swap(threadState);

/* Import the script module and run the fnc in that script module */
Pyobject *pModule = PyImport_Import(pScriptName);
PyObject *pFunc = PyObject_GetAttrString(pModule, pFuncName);
.....
/* End running the script and calling the script fnc */
Py_EndInterpreter(threadState);
PyEval_ReleaseLock();
}

Befor running this code i checked my memory heap pool available
memory. Then i called the above function to run my script script1.py.
Script ran succesfully, but after completion of the above fnc, when i
checked the memory there is a huge KB of memory is used by this code.
I have no doubt on my memory pool implementation, bcoz it isworking
from many years.
Now, My doubt is, when i call Py_EndInterpreter at the end does it not
clear the whole memory which was used in executing the script? Or
still the imported stuff from the script1.py is in memory only?

Would greatly appreciate the help....

vishnu
Dec 10 '06 #1
0 1213

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by lebo | last post: by
1 post views Thread by Haigu | last post: by
2 posts views Thread by Sambucus | last post: by
7 posts views Thread by andylcx | last post: by
18 posts views Thread by Ramasubbu Ramasubramanian XR (AS/EAB) | last post: by
14 posts views Thread by madhawi | last post: by
3 posts views Thread by Godzilla | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.