From: "Kent S." Date: 2004-03-12T04:49:38+09:00 Subject: Re: A few questions about Ruby/DL Josh Huber wrote: > > Okay, but it looks like by default PtrData#free is nil, right? Do I > always have to specify a freeing function? > > It seems as though the result of DL::malloc also does not have the > #free attribute set by default. Yes, you're right. I should have used DL.malloc instead of PtrData.malloc. DL.malloc sets free function by default: $ irb irb(main):001:0> require 'dl/import' => true irb(main):002:0> ptr = DL.malloc(DL.sizeof('I')) => # irb(main):003:0> ptr.free => # irb(main):004:0> > > > Thanks for this example, it's a little more clear now. Wouldn't you > want to set len.free to DL::FREE as well? > I should have used len = DL.malloc(DL.malloc('I')) instead. /kent