Unload Modules
Curtis Jensen
cjensen at bioeng.ucsd.edu
Fri Nov 10 12:46:40 EST 2000
Steve Juranich wrote:
>
> On Thu, 9 Nov 2000, Curtis Jensen wrote:
>
> > I can't seem to find a clear answer on this, but how do I remove an
> > imported module? I have some C modules that I import, the modules only
> > contain function calls. However, they are pretty big, and I'd like to
> > unload these modules after I am done with them, in order to save on
> > memory. I don't have the source for these modules.
> >
> > How can I unload these modules from within Python? Thanks.
> >
>
> AFAIU, all you need to do is 'del <module_name>'.
>
> HTH-ly y'rs,
I tried this. It removes the name from the namespace. However, it
doesn't drop the memory usage of python.
ie.
Python 1.5.2 (#4, Sep 5 2000, 10:29:12) [C] on irix646
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
Memory Usage: (As reported from top)
>>> 5MB (Python initual size)
>>> import my_module 19MB
>>> del my_module 19MB (Size didn't change)
--
Curtis Jensen
cjensen at bioeng.ucsd.edu
http://www-bioeng.ucsd.edu/~cjensen/
FAX (425) 740-1451
More information about the Python-list
mailing list