Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!ai-lab!zurich.ai.mit.edu!jinx From: jinx@zurich.ai.mit.edu (Guillermo J. Rozas) Newsgroups: comp.lang.scheme Subject: Re: garbage collection Message-ID: Date: 30 Apr 91 16:57:03 GMT References: <1991Apr28.193104.2627@cunixf.cc.columbia.edu> Sender: news@ai.mit.edu Reply-To: jinx@zurich.ai.mit.edu Organization: M.I.T. Artificial Intelligence Lab. Lines: 61 In-reply-to: pmw@cunixb.cc.columbia.edu's message of 28 Apr 91 19:31:04 GMT In article <1991Apr28.193104.2627@cunixf.cc.columbia.edu> pmw@cunixb.cc.columbia.edu (Peter M Williams) writes: Path: ai-lab!snorkelwacker.mit.edu!paperboy!think.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cunixf.cc.columbia.edu!cunixb.cc.columbia.edu!pmw From: pmw@cunixb.cc.columbia.edu (Peter M Williams) Newsgroups: comp.lang.scheme Date: 28 Apr 91 19:31:04 GMT Sender: usenet@cunixf.cc.columbia.edu (The Network News) Reply-To: pmw@cunixb.cc.columbia.edu Organization: Columbia University Lines: 10 Originator: pmw@cunixb.cc.columbia.edu Nntp-Posting-Host: cunixb.cc.columbia.edu I'm wondering if there is a way to turn off the garbage collection process in MIT scheme version 7.1.0. It seems to me that suppressing garbage collection until program completion may shorten the execution time for programs. Please let me know if you have any information on this. Thanks for any information. -Peter, pmw@cunixb.cc.columbia.edu There is a way. If you are not using the SICP compatibility package, you can use (with-absolutely-no-interrupts ) which will invoke thunk disallowing all interrupts, including GC (which is treated as an interrupt in our system). I don't recommend that you use this, however, unless you know that will not cons at all (or the system on its behalf). Otherwise you will cause the system to crash. MIT Scheme does not collect garbage spuriously, but only when it is out of storage. If it is out of storage, what would you have it do? Note that if your code is running interpreted, typically 90% of all consing is done by the interpreter, rather than the program you are running, and thus the frequency of garbage collection may be greater than what you would expect. In particular, programs that do not apparently cons will cause the system to GC when they are run interpreted. The compiler changes things significantly, but it is still possible for your program to cause garbage collections even if it does not explicitly invoke any allocation procedures. Passing and returning procedure objects often causes allocation, and the garbage collector must be run eventually. A completely different question is whether you can collect garbage pre-emptively. For example, the system could invoke the collector every time it types a prompt at a terminal, so that if the user takes any time to think about the next expression to type, the garbage collection will have been done in the interim. You can play with the global variable HOOK/CMDL-PROMPT, and the global procedure GC-FLIP and get this to work, and decide whether you like it better than the default.