[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reasons, why Miss Scheme should collect her garbage beforeshutdown.

>Here is my plead to those who are actively developing MzScheme: please
>make MzScheme collect garbage before exit!

You'll find that a lot of langauges with garbage collection do not guarantee that finalisers are called or that garbage is collected before the process exits. For example, both Functional Develoepr Dylan [1] and Java [2] do not guarantee that finalisers will be called.

Which leads to the rule that garbage collection is used for managing memory, not for managing other resources. 

Even when your object is finalised you can't guarantee when that will happen. An example. I've used a number of ODBC libraries for both Lisp and Dylan that rely on finalisation to free ODBC handles. Unfortunately when allocating a lot of ODBC statements you often run out of ODBC resources before any of them are finalised. Better is to provide an explicit means of freeing/closing resources.

A common idiom in Common Lisp and Dylan is to do a 'with...' style macro:

  with-open-file(fs = "blah.txt")

The macros frees or closes the resources at the end of the scope,

[1] http://www.functionalobjects.com 
[2] http://www.javasoft.com