Re: [racket-users] Strange garbage collection behavior with closures

2015-10-22 Thread Stephen Chang
pasterack uses make-module-evaluator in a sandbox. It's also still running 6.1.1. Would either of those cause the observed difference? On Wed, Oct 21, 2015 at 9:18 PM, Matthew Flatt wrote: > An empty closure is allocated as a constant --- similar to a literal > string or literal fraction in your

Re: [racket-users] Strange garbage collection behavior with closures

2015-10-22 Thread Matthew Flatt
I can't think of a case where strongly holding values is useful. Avoiding a layer of ephemerons is less work for the GC, and so `make-weak-hash` omits it to provide better performance for cases that don't need it. I'm not sure how much of a space and performance difference it makes in modern Racket

Re: [racket-users] Strange garbage collection behavior with closures

2015-10-21 Thread Scott Moore
Thanks for the quick response! Now that I’m past that, I see that my problem is probably due to the fact that a weak-hash holds its key strongly. Turns out this is well-documented in the guide, but I missed it since I was reading the reference. I’m curious, is there a particular use case for th

Re: [racket-users] Strange garbage collection behavior with closures

2015-10-21 Thread Matthew Flatt
An empty closure is allocated as a constant --- similar to a literal string or literal fraction in your program. The "closure" will stick around as long as the code does, and the code will stick around as the namespace where its loaded. If you change `(λ () 0`) to `(λ () (if box 0 'huh?))`, then y

[racket-users] Strange garbage collection behavior with closures

2015-10-21 Thread Scott Moore
I’m trying to do something a bit fancy that makes use of weak-hashes, but I’ve run into strange behavior (things not being removed that I believe should be) when I use keys that are closures. Doing some of my own debugging, this doesn’t appear specific to weak hashes, but also to weak boxes. Her