<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,6 @@
 
+v4.6. Allow snapshotting without running the GC first.
+
 v4.5. Enable SET_CURRENT_SOURCE() for better reporting (tmm1, joedamato).
 
 v4.4. Switch to Ruby 1.8.7p174.</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -14,9 +14,10 @@ static VALUE heaps_length(VALUE self) {
   return INT2FIX(rb_gc_heaps_length());
 }
 
-/* Walk the live, instrumented objects on the heap and write them to &lt;tt&gt;_logfile&lt;/tt&gt;. */
-static VALUE snapshot(VALUE self, VALUE _logfile) {
+/* Inner method; call BleakHouse.snapshot instead. */
+static VALUE ext_snapshot(VALUE self, VALUE _logfile, VALUE _gc_runs) {
   Check_Type(_logfile, T_STRING);
+  Check_Type(_gc_runs, T_FIXNUM);
 
   RVALUE *obj, *obj_end;
   st_table_entry *sym;
@@ -40,7 +41,7 @@ static VALUE snapshot(VALUE self, VALUE _logfile) {
   int i;
   char * chr;
 
-  for (i = 0; i &lt; 3; i++) {
+  for (i = 0; i &lt; FIX2INT(_gc_runs); i++) {
     /* request GC run */
     rb_funcall(rb_mGC, rb_intern(&quot;start&quot;), 0);
     rb_thread_schedule();
@@ -144,7 +145,7 @@ void
 Init_snapshot()
 {
   rb_mB = rb_define_module(&quot;BleakHouse&quot;);
-  rb_define_singleton_method(rb_mB, &quot;snapshot&quot;, snapshot, 1);
+  rb_define_singleton_method(rb_mB, &quot;ext_snapshot&quot;, ext_snapshot, 2);
   rb_define_singleton_method(rb_mB, &quot;heaps_used&quot;, heaps_used, 0);
   rb_define_singleton_method(rb_mB, &quot;heaps_length&quot;, heaps_length, 0);
 }</diff>
      <filename>ext/snapshot.c</filename>
    </modified>
    <modified>
      <diff>@@ -6,3 +6,17 @@ end
 RUBY_VERSION = `ruby -v`.split(&quot; &quot;)[1]
 require 'snapshot'
 require 'bleak_house/hook'
+
+class &lt;&lt; BleakHouse
+  private :ext_snapshot
+end
+  
+module BleakHouse
+
+  # Walk the live, instrumented objects on the heap and write them to 
+  # &lt;tt&gt;logfile&lt;/tt&gt;. Accepts an optional number of GC runs to perform
+  # before dumping the heap.
+  def self.snapshot(logfile, gc_runs = 3)
+    ext_snapshot(logfile, gc_runs)
+  end
+end</diff>
      <filename>lib/bleak_house.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,13 +18,19 @@ class BleakHouseTest &lt; Test::Unit::TestCase
   end
 
   def test_snapshot
-    symbol_count = Symbol.all_symbols.size
     BleakHouse.snapshot(FILE)
     assert File.exist?(FILE)
     assert BleakHouse.heaps_used &gt; 0
     assert BleakHouse.heaps_length &gt; 0
   end
 
+  def test_snapshot_gc_runs
+    BleakHouse.snapshot(FILE, 0)
+    assert File.exist?(FILE)
+    assert BleakHouse.heaps_used &gt; 0
+    assert BleakHouse.heaps_length &gt; 0
+  end
+
   def test_exception
     assert_raises(RuntimeError) do
       BleakHouse.snapshot(&quot;/&quot;)</diff>
      <filename>test/unit/test_bleak_house.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>92dc5c5797044a15dcbe75c67579460a697c8db2</id>
    </parent>
  </parents>
  <author>
    <name>Evan Weaver</name>
    <email>eweaver@twitter.com</email>
  </author>
  <url>http://github.com/fauna/bleak_house/commit/a77bc26285d9ee523b84791613d33311c71d2ef5</url>
  <id>a77bc26285d9ee523b84791613d33311c71d2ef5</id>
  <committed-date>2009-10-02T14:50:06-07:00</committed-date>
  <authored-date>2009-10-02T14:46:14-07:00</authored-date>
  <message>Control the GC runs.</message>
  <tree>76fb6aa52cb3ae8bf7c832540a303fe403861a5f</tree>
  <committer>
    <name>Evan Weaver</name>
    <email>eweaver@twitter.com</email>
  </committer>
</commit>
