Re: [racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
I've actually simplified my program that causes the issues and it doesn't need the callback or the foreign functions at all it just needs structs with substructs. This shows that if garbage is collected after making the substruct is complete then the finalizer gets run, which trashes the memory I'

Re: [racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
Parsing it out in atomic mode probably will work, I'll look at that. The callback method I described is actually not how it works, and it is a bit more complicated (involving a separate place and blocking foreign calls), but I can do all of the decomposing work in atomic mode. I think I'm avoiding

Re: [racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Matthew Flatt
Is the work to parse out the values short enough that you can do it atomically in response to the notification that says the data is ready? If so, it's probably best to parse and free in atomic mode. Or can you at least atomically separate out references to children, where finalizers can sensibly b

[racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
I'm dealing with some foreign apis that want to be passed long lived output pointers to structs. The apis eventually call back indicating that the struct has been filled in appropriately and then I want to read out the values and deallocate the structs. I'm using atomic interior memory for these st