Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Run a ruby collection during the c9 collection.

  • Loading branch information...
commit 184908190016b60ed80c14fe51de41feb94d1487 1 parent ec415d8
Graham Batty authored

Showing 1 changed file with 14 additions and 0 deletions. Show diff stats Hide diff stats

  1. +14 0 ext/channel9ext.cpp
14 ext/channel9ext.cpp
@@ -115,6 +115,7 @@ template <typename tVal>
115 115 struct stupid_shim_for_old_gcc {
116 116 static void free_gc_ref(GCRef<tVal> *obj)
117 117 {
  118 + TRACE_PRINTF(TRACE_GENERAL, TRACE_DEBUG, "Deleting gcref %p\n", obj);
118 119 delete obj;
119 120 }
120 121 };
@@ -636,8 +637,21 @@ static void Init_Channel9_Primitives()
636 637 rb_define_method(rb_cSymbol, "channel_send", ruby_method(Primitive_channel_send), 3);
637 638 }
638 639
  640 +class RubyCollector : GCRoot
  641 +{
  642 +public:
  643 + RubyCollector() : GCRoot(value_pool) {}
  644 +
  645 + void scan()
  646 + {
  647 + rb_gc_start();
  648 + }
  649 +};
  650 +
639 651 extern "C" void Init_channel9ext()
640 652 {
  653 + static RubyCollector collector;
  654 +
641 655 rb_mChannel9 = rb_define_module("Channel9");
642 656 rb_mPrimitive = rb_define_module_under(rb_mChannel9, "Primitive");
643 657 Init_Channel9_Environment();

0 comments on commit 1849081

Please sign in to comment.
Something went wrong with that request. Please try again.