chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1173: Symbols help in GC-roots are sometimes collect


From: Chicken Trac
Subject: [Chicken-janitors] #1173: Symbols help in GC-roots are sometimes collected in "symbol-gc" mode
Date: Sat, 13 Dec 2014 13:35:10 -0000

#1173: Symbols help in GC-roots are sometimes collected in "symbol-gc" mode
----------------------------+-----------------------------------------------
 Reporter:  felix           |       Owner:         
     Type:  defect          |      Status:  new    
 Priority:  major           |   Milestone:  someday
Component:  core libraries  |     Version:  4.9.x  
 Keywords:                  |  
----------------------------+-----------------------------------------------
 (Initially reported by sjamaan)

 If a symbol is stored in a GC-root, then it may be collected when symbol-
 GC is enabled (with the `-:w` runtime option). Here a simple test case:

 {{{
 (foreign-declare
  "static void *root;
   static void foo(C_word x)
   {
     root = CHICKEN_new_gc_root();
     CHICKEN_gc_root_set(root, x);
   }
   static C_word bar() { return CHICKEN_gc_root_ref(root); }")

 (define foo (foreign-lambda void "foo" scheme-object))
 (define bar (foreign-lambda scheme-object "bar"))

 (gc #t)
 (foo (string->symbol "FOO"))
 (gc #t)
 (print (eq? (string->symbol "FOO") (bar)))
 }}}

 Without `-:w`, this will print `#t`, with `-:w` it will print `#f`
 (sometimes, not always. of course)

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/1173>
CHICKEN Scheme <http://www.call-with-current-continuation.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]