At Sun, 14 Oct 2018 18:20:42 -0700 (PDT), Alex Harsanyi wrote:
> However, I don't think it is a good idea to create many widgets dynamically 
> in event callbacks, than just leave them around to be garbage collected, 
> which your example code does.

That does seem to be the problem. The GC doesn't run often enough to
finalize windows that have been created and then removed, and so
`racket/gui` runs out of a constrained resource at the underlying
Windows level.

Specifically, if I turn on the "User handles" column in the Task
Manager's "Details" panel while clicking "All" and "None", I can see
that the crash happens when that number in that column approaches 10k.
My machine is configured with a 10k limit on "user handles", so that's
all consistent.

Forcing a garbage collection with `(collect-garbage)` immediately
resets the count to 500 or so (when "All" was just clicked) or 50 or so
(when "None" was just clicked). So, that's one possible workaround:
force a full collection periodically with `(collect-garbage)`.

The `racket/gui` library itself should force a GC as needed, and it
should fail with a clearer error message when a window creation fails
due to a resource limit.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to