[Tutor] garbage collecting

Alan Gauld alan.gauld at btinternet.com
Wed Jan 8 11:41:44 CET 2014


On 08/01/14 08:15, Mark Lawrence wrote:

>> I just saw where I could do os.system('python'), but in restarting the
>> interpreter I'd lose everything currently loaded: my real question
>> involves merely pushing the garbage collector into action, I think.

Don't do that!
You are not restarting the interpreter you are starting a brand new 
interpreter *in addition* to the one that's already running. Now you 
have even less resources to play with. It will make things worse not better.

os.system() is really for running shell commands that hopefully don't 
take long, do a job that doesn't need any input and produces output that 
you don't need to process(or a file that you can). Printing
a file, converting a file with lame of ffmpeg, say, that kind of thing.
It's actually deprecated now anyway and the subprocess module is preferred.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list