>>>>> "T" == Tilman Sauerbeck <tilman / code-monkey.de> writes:

T> I'm confused - I thought I'm telling Ruby in what order the objects
T> should be freed by the way I'm calling rb_gc_mark().

T> If I cannot define the order in which the objects are freed by the
T> rb_gc_mark() function calls, how else could I do that?

 I can *only* give you an example

svg% cat b.rb
#!/usr/bin/ruby
require 'bz2'
io = File.open('b.rb.bz2', 'w')
bz2 = BZ2::Writer.new(io)
IO.foreach('b.rb') do |line|
   bz2.puts line
end
svg% 

svg% b.rb
svg% 

svg% bunzip2 < b.rb.bz2
#!/usr/bin/ruby
require 'bz2'
io = File.open('b.rb.bz2', 'w')
bz2 = BZ2::Writer.new(io)
IO.foreach('b.rb') do |line|
   bz2.puts line
end
svg% 

 To make this example work, `bz2' must be freed before `io' because it must
 flush its buffer.

 bz2.c is written in such way, that it don't depend in what order the
 objects will be freed.


Guy Decoux