On 10/05/2017 05:42 PM, Fetchinson . via Python-list wrote:
On 10/5/17, Chris Angelico <ros...@gmail.com> wrote:
On Fri, Oct 6, 2017 at 8:06 AM, Fetchinson . via Python-list
<python-list@python.org> wrote:
     import mystuff
     mystuff.some_more_expensive_stuff( x )
     del mystuff
     del x
You're not actually deleting anything. When you say "del x", all
you're doing is removing the *name* x. Especially, deleting an
imported module basically does nothing; it's a complete waste of time.
Modules are kept in their own special cache.

Meaning that if mystuff has some leaky stuff in it, there is no way
for me to recover?

Even if deleting mystuff actually removed it the objects that it created would still exist. Import mystuff once at the top of your script. Importing over and over just costs CPU and could, in fact, be contributing to your leak.

Also, I am pretty sure that the two del statements don't do anything that ending the loop doesn't already do anyway. Your best option is to find the leak.

--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to