* Goswin Brederlow: > I assumed that when the program exits normaly that all memory will be > freed, specifically that *_finalize(value) is called for all custom > blocks in case they have to do some custom cleanup. Unfortunately that > is not the case.
Having this functionality could be useful in some cases (like embedded databases, where proper closing may avoid costly recovery on the next program invocation). > In my case I want to make sure there are no pending IO operations left > in the queue when the program exits, specially no write operations > still waiting to complete, as otherwise there might be data lost. > Other uses for this could be removal of temp files, logging out from > network connections (ftp, databases, ...), freeing of IPC resources > and many more. As a rule of thumb, you must not rely on finalization for externally visible resources. Finalization is inherently asynchronous, and you hardly ever want such external interaction at random points in time. In addition, it is hard to instruct the garbage collector to collect unused objects in time before external resources are exhosted (because the collector only knows about memory and not the scarcity of other resources). It's better to use with-macro-style wrappers for managing external state. -- To UNSUBSCRIBE, email to debian-ocaml-maint-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org