George: I don't see that invariant for java in anything that I search for
on Java finalizers. Do you have a reference? In particular java only has
one finalizer per object (the finalize method) and across objects the
references I found seem to imply that there is no guaranteed order?
https://en.wikipedia.org/wiki/Finalization#Connection_with_finally seems to
imply no ordering across finalizers.
Matthew: Ok, I'll just file a bug to track the issue. I'm trying to do the
best available solution following standard practices, and not actually that
worried about the memory leak for my program.
On Mon, Oct 2, 2017 at 1:48 PM, George Neuner <gneun...@comcast.net> wrote:
> On 10/2/2017 2:52 PM, Matthew Flatt wrote:
> If we change `ffi/unsafe/alloc` so that a custodian shutdown runs all
> deallocators, that would work in many cases. It would create a problem,
> however, if there are objects to deallocate where the deallocation
> function references other objects that themselves must be deallocated.
> That is, an allocated value A might depend on an allocated value B up
> until the point that A has been deallocated. That dependency can be
> expressed to `ffi/unsafe/alloc` (via the garbage collector) by
> including a reference to B in the deallocation closure for A. Setting
> up dependencies that way is not common, but I'm pretty sure I've used
> that pattern once or twice. Meanwhile, there's no similar way to order
> callbacks that are registered with a custodian.
> IIRC, the JVM executes finalizers in reverse order of registration -
> expecting that, in your example, A would have been allocated before B. Is
> that something that would work here? [He asks naively.]
> I'm tempted to say that `ffi/unsafe/alloc` should only be used for
> objects where the deallocation order doesn't matter, so that
> deallocators can be triggered by a custodian shutdown. But an
> additional constraint is needed: values to be deallocated cannot be
> used by any other custodian-shutdown callbacks. That additional
> constraint seems too limiting.
> Maybe we need to add some sort of ordering constraints to custodians,
> but I'm not immediately sure of the right way to do that.
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.