Python GC does not work as it should be
Jean-Paul Calderone
exarkun at divmod.com
Mon Jun 16 06:59:34 EDT 2008
On Mon, 16 Jun 2008 17:51:00 +0700, Jaimy Azle <jazle at nospam.log.web.id> wrote:
>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.
A system exception? What's that? C doesn't have exceptions.
Jean-Paul
More information about the Python-list
mailing list