[issue9072] Unloading modules - memleaks?

2010-06-24 Thread Slava

New submission from Slava bomb...@gmail.com:

I don't know whether this is a bug, but my exhaustive search led me to Python 
can't really unload modules from every direction, which I find hard to 
believe, I don't know where else to go with this.

The problem:

  import gc, sys
  print len(gc.get_objects()) # 4073
  # starting with 4073 objects in memory

  import httplib
  del sys.modules[httplib]
  del httplib

  # httplib should be unloaded 
  # and garbage collected as it is unreachable

  gc.collect()
  print len(gc.get_objects()) # 6745 
  # 6745 objects in memory (2000+ stray objects)

This applies to almost any module. 
Is this a bug or somehow correctable?

--
components: None
messages: 108545
nosy: yappie
priority: normal
severity: normal
status: open
title: Unloading modules - memleaks?
type: resource usage
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9072
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9072] Unloading modules - memleaks?

2010-06-24 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

This is not a bug. You didn't *nearly* reset Python to the state in which it 
was before the import: the modules that got imported recursively still hang in 
sys.modules.

Please accept that Python indeed does not support unloading modules for severe, 
fundamental, insurmountable, technical problems, in 2.x.

In 3.x, chances are slightly higher. In principle, unloading could be supported 
- but no module actually adds the necessary code, and the necessary code in the 
import machinery isn't implemented in 3.2 and earlier.

Supporting unloading will be (and was) a multi-year project. Don't expect any 
results in the next five years.

--
nosy: +loewis
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9072
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9072] Unloading modules - memleaks?

2010-06-24 Thread Slava

Slava bomb...@gmail.com added the comment:

Thank you for taking time to answer my question about unloading modules.
I really appreciate it!

Slava

On Fri, Jun 25, 2010 at 2:43 AM, Martin v. Löwis rep...@bugs.python.orgwrote:


 Martin v. Löwis mar...@v.loewis.de added the comment:

 This is not a bug. You didn't *nearly* reset Python to the state in which
 it was before the import: the modules that got imported recursively still
 hang in sys.modules.

 Please accept that Python indeed does not support unloading modules for
 severe, fundamental, insurmountable, technical problems, in 2.x.

 In 3.x, chances are slightly higher. In principle, unloading could be
 supported - but no module actually adds the necessary code, and the
 necessary code in the import machinery isn't implemented in 3.2 and earlier.

 Supporting unloading will be (and was) a multi-year project. Don't expect
 any results in the next five years.

 --
 nosy: +loewis
 resolution:  - wont fix
 status: open - closed

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue9072
 ___


--
Added file: http://bugs.python.org/file17764/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9072
___Thank you for taking time to answer my question about unloading 
modules. divI really appreciate 
it!/divdivbr/divdivSlavabrbrdiv class=gmail_quoteOn Fri, Jun 
25, 2010 at 2:43 AM, Martin v. Löwis span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span 
wrote:br
blockquote class=gmail_quote style=margin:0 0 0 .8ex;border-left:1px #ccc 
solid;padding-left:1ex;br
Martin v. Löwis lt;a 
href=mailto:mar...@v.loewis.de;mar...@v.loewis.de/agt; added the 
comment:br
br
This is not a bug. You didn#39;t *nearly* reset Python to the state in which 
it was before the import: the modules that got imported recursively still hang 
in sys.modules.br
br
Please accept that Python indeed does not support unloading modules for severe, 
fundamental, insurmountable, technical problems, in 2.x.br
br
In 3.x, chances are slightly higher. In principle, unloading could be supported 
- but no module actually adds the necessary code, and the necessary code in the 
import machinery isn#39;t implemented in 3.2 and earlier.br

br
Supporting unloading will be (and was) a multi-year project. Don#39;t expect 
any results in the next five years.br
br
--br
nosy: +loewisbr
resolution:  -gt; wont fixbr
status: open -gt; closedbr
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue9072; 
target=_blankhttp://bugs.python.org/issue9072/agt;br
___br
/div/div/blockquote/divbr/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com