[MLton-user] Does GC always trigger MLtonFinalizable?
Vesa Karvonen
vesa.karvonen at cs.helsinki.fi
Fri Feb 16 11:41:31 PST 2007
Quoting "Wesley W. Terpstra" <wesley at terpstra.ca>:
[...]
> The database handle has actual file descriptors and other system
> resources. I wanted people to explicitly close this like in the basis.
>
> However, you may be right. If I use finalizers for queries, perhaps I
> should also use a finalizer for the database. Although, then it is
> possible to leak file handles until a GC.
[...]
Why not just keep a list of unfinalized queries with the DB handle and
close them explicitly when the DB handle is closed? The list of
unfinalized queries could be implemented as a doubly linked mutable
ring and query finalizers, when executed, would remove the finalized
nodes from the ring.
-Vesa Karvonen
More information about the MLton-user
mailing list