newbie question - remove a module from ram

john fabiani jfabiani at yolo.com
Mon May 10 16:07:18 EDT 2004


Michael Hudson wrote:

> john fabiani <jfabiani at yolo.com> writes:
> 
> 
>>Paul McGuire wrote:
>>
>>>So then what if he follows up with:
>>>    del sys.modules["random"]
>>>Are there any other dangling references to this module that would
>>>stymie the
>>>garbage collector (assuming that the OP hasn't saved off his own reference
>>>to the module)?
>>>-- Paul
>>>
>>
>>I think I follow:  but doesn't the garbage collector decide what is to
>>be done?   Assuming that there were no dangling references wouldn't
>>the ram be available for re-use?
> 
> 
> Well, that depends on vagaries of your allocator, but probably.
> 
> Why are you so worried about the RAM your modules take up?
> 
> Cheers,
> mwh
> 
Well I guess I don't have an example that I can bring up.  It's just an 
after thought that if I create a large program that everything is being 
stored in ram (or swap).  At some point I'll run out of ram and the more 
  I limit the stuff I load and can't release the better.  In the windows 
world I release().  When I monitor the ram usage (task manager) I can 
see the ram usage lower when I release().  I keep thinking about all the 
forms and the associated code I load in my windows programs.  If I kept 
all the forms in ram I'd run out quickly.  Of course I work with 
accounting packages....
John



More information about the Python-list mailing list