Re: [racket-dev] Testing whether a procedure gets collected

2012-12-06 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01-12-12 18:45, Neil Toronto wrote: Rather than a guarantee (or a probabilistic estimate) of actual collection, could the garbage collector's opinion of what is or isn't garbage be exposed somehow? Marijn -BEGIN PGP SIGNATURE- Version: G

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-03 Thread Robby Findler
Thanks. Is the N suggestion a future-proofing kind of a thing, or is there something today that could cause such a test to pass where a single one might fail? Robby On Mon, Dec 3, 2012 at 10:42 AM, Matthew Flatt wrote: > This guide material (as opposed to language specification and > guarantees)

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-03 Thread Matthew Flatt
This guide material (as opposed to language specification and guarantees) looks pretty good to me. I'll edit and add the suggestion of N allocations. At Mon, 3 Dec 2012 10:39:09 -0600, Robby Findler wrote: > Let me also say that I think it is important to give advice on how to > test so I think we

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-03 Thread Robby Findler
Let me also say that I think it is important to give advice on how to test so I think we need to say something. Robby On Mon, Dec 3, 2012 at 10:37 AM, Robby Findler wrote: > On Mon, Dec 3, 2012 at 7:47 AM, Matthew Flatt wrote: >> At Mon, 3 Dec 2012 08:04:15 -0500, Sam Tobin-Hochstadt wrote: >>>

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-03 Thread Robby Findler
On Mon, Dec 3, 2012 at 7:47 AM, Matthew Flatt wrote: > At Mon, 3 Dec 2012 08:04:15 -0500, Sam Tobin-Hochstadt wrote: >> On Mon, Dec 3, 2012 at 7:54 AM, Robby Findler >> wrote: >> > >> > I agree that when something is collected is a pretty intentional >> > property but I think it is possible to sa

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-03 Thread Matthew Flatt
At Mon, 3 Dec 2012 08:04:15 -0500, Sam Tobin-Hochstadt wrote: > On Mon, Dec 3, 2012 at 7:54 AM, Robby Findler > wrote: > > > > I agree that when something is collected is a pretty intentional > > property but I think it is possible to say a little bit more since > > there is a pretty stable core i

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-03 Thread Sam Tobin-Hochstadt
On Mon, Dec 3, 2012 at 7:54 AM, Robby Findler wrote: > > I agree that when something is collected is a pretty intentional > property but I think it is possible to say a little bit more since > there is a pretty stable core idea there (namely that if something > isn't reachable and you call collect

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-03 Thread Robby Findler
On Sun, Dec 2, 2012 at 11:40 PM, Neil Toronto wrote: > On 12/02/2012 12:10 PM, Robby Findler wrote: >> >> On Sun, Dec 2, 2012 at 11:43 AM, Matthias Felleisen >> wrote: >>> >>> >>> On Dec 1, 2012, at 9:23 PM, Robby Findler wrote: >>> I think the high-level answer is that you have to understan

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-02 Thread Neil Toronto
On 12/02/2012 12:10 PM, Robby Findler wrote: On Sun, Dec 2, 2012 at 11:43 AM, Matthias Felleisen wrote: On Dec 1, 2012, at 9:23 PM, Robby Findler wrote: I think the high-level answer is that you have to understand something about details that aren't currently specified but nevertheless are h

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-02 Thread Robby Findler
On Sun, Dec 2, 2012 at 11:43 AM, Matthias Felleisen wrote: > > On Dec 1, 2012, at 9:23 PM, Robby Findler wrote: > >> I think the high-level answer is that you have to understand something >> about details that aren't currently specified but nevertheless are how >> things currently work and then ma

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-02 Thread Matthias Felleisen
On Dec 1, 2012, at 9:23 PM, Robby Findler wrote: > I think the high-level answer is that you have to understand something > about details that aren't currently specified but nevertheless are how > things currently work and then make a test that will work when you > make those additional assumptio

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-01 Thread Robby Findler
I think the high-level answer is that you have to understand something about details that aren't currently specified but nevertheless are how things currently work and then make a test that will work when you make those additional assumptions (and then keep it running in drdr so you can tell when t

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-01 Thread Neil Toronto
On 12/01/2012 07:05 PM, Neil Toronto wrote: Ah. It prints #f for me when I have debugging info turned on in DrRacket; otherwise I get #. Must be inlining keeping it around or something. The problem with either finalizers or weak boxes is that neither provides enough guarantees. Finalizers are ne

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-01 Thread Neil Toronto
Ah. It prints #f for me when I have debugging info turned on in DrRacket; otherwise I get #. Must be inlining keeping it around or something. The problem with either finalizers or weak boxes is that neither provides enough guarantees. Finalizers are never guaranteed to be run. A weak box may

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-01 Thread Robby Findler
This prints #f for me. #lang racket (define (make-box-thing v) (make-weak-box (λ (_) v))) (define bx (make-box-thing 4)) (collect-garbage) (weak-box-value bx) And I guess that non-closure procedures are held onto by the modules they are inside. This program prints #f for me, and it seems to c

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-01 Thread Neil Toronto
Honestly, because I was too rushed to try them before I had to leave this morning. :D However, now that I have the chance, I've found that Typed Racket doesn't support them. I can't add support using `required/typed', because `Weak-Box' would have to be a polymorphic type. Also, they don't see

Re: [racket-dev] Testing whether a procedure gets collected

2012-12-01 Thread Robby Findler
How about using a weak box instead? Robby On Sat, Dec 1, 2012 at 11:45 AM, Neil Toronto wrote: > I'm getting ready to push a change to math/array that fixes a memory leak. > I've devised a test that I think will determine whether an array's procedure > gets collected after the array is made stri

[racket-dev] Testing whether a procedure gets collected

2012-12-01 Thread Neil Toronto
I'm getting ready to push a change to math/array that fixes a memory leak. I've devised a test that I think will determine whether an array's procedure gets collected after the array is made strict, but I don't know whether it works only by accident. Here it is: (define: collected? : (Boxof B