J
Jaimy Azle
See this piece of code:
/* API to invoke gc.collect() from C */
Py_ssize_t
PyGC_Collect(void)
{
Py_ssize_t n;
if (collecting)
n = 0; /* already collecting, don't do anything */
else {
collecting = 1;
n = collect(NUM_GENERATIONS - 1);
collecting = 0;
}
return n;
}
If a system exception raised when executing collect(xxx), collecting state
variable would never be reset and python GC will not works forever until the
application restarted. Perhaps it is a rare situation on normal usage, i
mean if 100% code written in python. I use python as an embedded engine on a
multithreaded server handling business process script which written in
python. Though at last i found my code that causing it and fixed, i still
think those code still has a potential problem on a long running process (as
server side scripting language). My workaround limited to implementation
with MSVC, I wrap those code in an exception trapper, and force to reset
collecting variable.
Salam,
-Jaimy.
/* API to invoke gc.collect() from C */
Py_ssize_t
PyGC_Collect(void)
{
Py_ssize_t n;
if (collecting)
n = 0; /* already collecting, don't do anything */
else {
collecting = 1;
n = collect(NUM_GENERATIONS - 1);
collecting = 0;
}
return n;
}
If a system exception raised when executing collect(xxx), collecting state
variable would never be reset and python GC will not works forever until the
application restarted. Perhaps it is a rare situation on normal usage, i
mean if 100% code written in python. I use python as an embedded engine on a
multithreaded server handling business process script which written in
python. Though at last i found my code that causing it and fixed, i still
think those code still has a potential problem on a long running process (as
server side scripting language). My workaround limited to implementation
with MSVC, I wrap those code in an exception trapper, and force to reset
collecting variable.
Salam,
-Jaimy.