Thanks for the fix and the stress test!
Also, I want to make sure I understand this:
On 12/11/2012 09:32 AM, [email protected] wrote:
collects/math/private/bigfloat/mpfr.rkt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- OLD/collects/math/private/bigfloat/mpfr.rkt
+++ NEW/collects/math/private/bigfloat/mpfr.rkt
@@ -76,9 +76,14 @@
[(_ name type fail-thunk) (get-ffi-obj name mpfr-lib type fail-thunk)]))
(define mpfr-free-cache (get-mpfr-fun 'mpfr_free_cache (_fun -> _void)))
-#;
+
(define mpfr-shutdown
- (register-custodian-shutdown mpfr-free-cache (λ (free) (free))))
+ (register-custodian-shutdown
+ mpfr-free-cache ; acts as a "random" object for a shutdown handle
+ (λ (free)
+ ;; The direct reference here is important, since custodian holds only
+ ;; a weak reference to shutdown handle:
+ (mpfr-free-cache))))
Is the problem here that `free' may point to an object that has been
collected, or may be #f because the object has been collected?
If so, then the callback procedure can't rely on the value of `free'
unless it contains its own reference to `free'. So why pass it? Also,
why doesn't the module's reference to `mpfr-free-cache' count? Because
the module may have been collected already?
Neil ⊥
_________________________
Racket Developers list:
http://lists.racket-lang.org/dev