Ivan Maidanski
2017-01-11 19:51:39 UTC
Hello Hans,
Looking into GC_allocobj, it has the following:
   while (*flh == 0) {
     ENTER_GC();
     /* Do our share of marking work */
     if (TRUE_INCREMENTAL) GC_collect_a_little_inner(1); // calls GC_mark_some which, in turn, sets some mark bits
     /* Sweep blocks for objects of this size */
     GC_continue_reclaim(gran, kind); // reclaims some objects with unset mark bits
     ...
   }
Is this ok to reclaim memory before finishing the collection?
I have added the assertions to reclaim.c functions which examine mark bits (see the attachment), and do gctest on linux/x64 as follows:
gcc -I include -DGC_ASSERTIONSÂ -DGC_TIME_LIMIT=1 -DGC_THREADS -I libatomic_ops/src tests/test.c extra/gc.c -lpthread -ldl
./a.out
Switched to incremental mode
Emulating dirty bits with mprotect/signals
Assertion failure: extra/../reclaim.c:335 // GC_allocobj -> GC_continue_reclaim -> GC_reclaim_small_nonempty_block
Regards,
Ivan
Looking into GC_allocobj, it has the following:
   while (*flh == 0) {
     ENTER_GC();
     /* Do our share of marking work */
     if (TRUE_INCREMENTAL) GC_collect_a_little_inner(1); // calls GC_mark_some which, in turn, sets some mark bits
     /* Sweep blocks for objects of this size */
     GC_continue_reclaim(gran, kind); // reclaims some objects with unset mark bits
     ...
   }
Is this ok to reclaim memory before finishing the collection?
I have added the assertions to reclaim.c functions which examine mark bits (see the attachment), and do gctest on linux/x64 as follows:
gcc -I include -DGC_ASSERTIONSÂ -DGC_TIME_LIMIT=1 -DGC_THREADS -I libatomic_ops/src tests/test.c extra/gc.c -lpthread -ldl
./a.out
Switched to incremental mode
Emulating dirty bits with mprotect/signals
Assertion failure: extra/../reclaim.c:335 // GC_allocobj -> GC_continue_reclaim -> GC_reclaim_small_nonempty_block
Regards,
Ivan