Paste number 24116: gc conservatism

Paste number 24116: gc conservatism
Pasted by: mega
When:2 years, 10 months ago
Share:Tweet this! | http://paste.lisp.org/+ILW
Channel:None
Paste contents:
Raw Source | XML | Display As
A weak key hash table with 100 fresh elements that should be gc'd away is set up, and then I try to make everything possible to make it so: full gc and control stack scrubbing. Finally gc is initiated from another thread and we win. Should work with simple weak pointers too.

CL-USER> (setq *ht* (test-removal :key))
#<HASH-TABLE :TEST EQL :COUNT 100 {A67A929}>
CL-USER> (gc :full t)

NIL
CL-USER> *ht*
#<HASH-TABLE :TEST EQL :COUNT 7 {A621109}>
CL-USER> (gc :full t)

NIL
CL-USER> *ht*
#<HASH-TABLE :TEST EQL :COUNT 7 {A622109}>
CL-USER> (gc :full t)

NIL
CL-USER> *ht*
#<HASH-TABLE :TEST EQL :COUNT 7 {A621109}>
CL-USER> (sb-sys:scrub-control-stack)
4
CL-USER> (gc :full t)

NIL
CL-USER> *ht*
#<HASH-TABLE :TEST EQL :COUNT 7 {A622109}>
;; Do a gc in another thread:
;;;; (gc :full t) ...
CL-USER> *ht*
#<HASH-TABLE :TEST EQL :COUNT 0 {A6210E9}>

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.