Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: Does Python cache the startup module?
Fredrik Lundh
1/7/2008 8:23:00 PM
Baz Walter wrote:
> Before changing the name 'mainwindow' to 'mainwidget' it reports:
>
> Widgets left: 0 Max widgets: 2
> Widgets left: 0 Max widgets: 149 (full program)
>
> Afterwards it reports:
>
> Widgets left: 1 Max widgets: 2
> Widgets left: 146 Max widgets: 149 (full program)
So what you're concerned about is the lack of cleanup during interpreter
shutdown, not a true leak (which would result in "Max widgets" growing
towards infinity).
The problem here is that you're relying on Python's GC to remove things
in a given order during shutdown, something that may or may not happen
depending on lots of things that you cannot control:
http://www.python.org/doc/essay...
(Note the repeated use of "In an order determined by the dictionary
hashing of the names" in that article.)
The only way to get *predictable* shutdown behaviour in situations like
this is to clean things up yourself. But in this case, you might as
well leave the cleanup to the OS.
</F>
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Does Python cache the startup module?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password