Skip to content

Instantly share code, notes, and snippets.

@FooBarWidget
Created March 29, 2009 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FooBarWidget/87517 to your computer and use it in GitHub Desktop.
Save FooBarWidget/87517 to your computer and use it in GitHub Desktop.
diff --git a/gc.c b/gc.c
index f4ec581..ae2a6d6 100644
--- a/gc.c
+++ b/gc.c
@@ -854,6 +854,9 @@ add_heap()
if (heap_slots <= 0) heap_slots = heap_min_slots;
while (p < pend) {
+ if (freelist == p) {
+ rb_bug("freelist == p (1)");
+ }
p->as.free.flags = 0;
p->as.free.next = freelist;
freelist = p;
@@ -1515,6 +1518,9 @@ finalize_list(p)
* which can destroy copy-on-write semantics.
*/
if (!FL_TEST(p, FL_SINGLETON) && p->as.free.flags != 0) {
+ if (freelist == p) {
+ rb_bug("freelist == p (2)");
+ }
p->as.free.flags = 0;
p->as.free.next = freelist;
rb_mark_table_remove(p);
@@ -1653,6 +1659,9 @@ gc_sweep()
if (need_call_final && FL_TEST(p, FL_FINALIZE)) {
/* This object has a finalizer, so don't free it right now, but do it later. */
rb_mark_table_heap_add(heap, p); /* remain marked */
+ if (final_list == p) {
+ rb_bug("final_list == p (1)");
+ }
p->as.free.next = final_list;
final_list = p;
}
@@ -1663,6 +1672,9 @@ gc_sweep()
free_counts[obt]++;
}
}
+ if (freelist == p) {
+ rb_bug("freelist == p (3)");
+ }
/* Do not touch the fields if they don't have to be modified.
* This is in order to preserve copy-on-write semantics.
*/
@@ -1737,6 +1749,9 @@ void
rb_gc_force_recycle(p)
VALUE p;
{
+ if (freelist == p) {
+ rb_bug("freelist == p (4)");
+ }
RANY(p)->as.free.flags = 0;
RANY(p)->as.free.next = freelist;
rb_mark_table_remove((RVALUE *) p);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment