Garbage collection

Alex Martelli aleax at mac.com
Thu Mar 22 00:47:05 EDT 2007


Tom Wright <tew24 at spam.ac.uk> wrote:

> real programs.  I can't help thinking that there are some situations where
> you need a lot of memory for a short time though, and it would be nice to
> be able to use it briefly and then hand most of it back.  Still, I see the
> practical difficulties with doing this.

What I do in those cases:
a. fork
b. do the memory-hogging work in the child process
c. meanwhile the parent just waits
d. the child sends back to the parent the small results
e. the child terminates
f. the parent proceeds merrily

I learned this architectural-pattern a long, long time ago, around the
time when fork first got implemented via copy-on-write pages... 


Alex



More information about the Python-list mailing list