Z
Zed A. Shaw
Hi,
While writing the Ruby/Odeum C extension I ran into this problem where
object allocated inside an each block did not get collected until the
each block exited.
At first I thought it was because I had implemented the each block in C
and I wasn't doing something right. But then I got rid of the C each
block and used a Ruby each in the test scripts and saw the same problem.
Objects will get allocated from the C extension, build up during the
each execution, and then at the end they get properly collected. I
verified this by having the registered free functions print a message to
stdout.
My current solution is to have an explicity "close" method on the one
object that offends the most and warn the users, but I'm wondering if
there's some C extension magic that I'm misssing.
Any help is greatly appreciated.
Zed A. Shaw
http://www.zedshaw.com/
While writing the Ruby/Odeum C extension I ran into this problem where
object allocated inside an each block did not get collected until the
each block exited.
At first I thought it was because I had implemented the each block in C
and I wasn't doing something right. But then I got rid of the C each
block and used a Ruby each in the test scripts and saw the same problem.
Objects will get allocated from the C extension, build up during the
each execution, and then at the end they get properly collected. I
verified this by having the registered free functions print a message to
stdout.
My current solution is to have an explicity "close" method on the one
object that offends the most and warn the users, but I'm wondering if
there's some C extension magic that I'm misssing.
Any help is greatly appreciated.
Zed A. Shaw
http://www.zedshaw.com/