Safe to call Py_Initialize() frequently?

Graham Dumpleton Graham.Dumpleton at gmail.com
Sun Mar 29 16:00:16 EDT 2009


On Mar 30, 4:35 am, a... at pythoncraft.com (Aahz) wrote:
> [p&e]
>
> In article <e97efd52-4868-47a5-91ec-657bba5f0... at z16g2000prd.googlegroups.com>,
> Graham Dumpleton  <Graham.Dumple... at gmail.com> wrote:
>
>
>
>
>
> >In mod_wsgi however, Apache will completely unload the mod_wsgi module
> >on a restart. This would also mean that the Python library is also
> >unloaded from memory. When it reloads both, the global static
> >variables where information was left behind have been lost and nulled
> >out. Thus Python when initialised again, will recreate the data it
> >needs.
>
> >So, for case where Python library unloaded, looks like may well suffer
> >a memory leak regardless.
>
> >As to third party C extension modules, they aren't really an issue,
> >because all that is done in Apache parent process is Py_Initialize()
> >and Py_Finalize() and nothing else really. Just done to get
> >interpreter setup before forking child processes.
>
> >There is more detail on this analysis in that thread on mod_wsgi list
> >at:
>
> Missing reference?

It was in an earlier post. Yes I knew I forget to add it again, but
figured people would read the whole thread.

  http://groups.google.com/group/modwsgi/browse_frm/thread/65305cfc798c088c

Graham



More information about the Python-list mailing list