Ruby Extension Code in C, GC Question

P

Pie Squared

I've read this article: http://fixnum.org/ruby_c.html

It explains how to write a ruby extension in C, and explains how to
make the GC work with the new types you've defined.

However, it leaves me with one question:

What happens if you create a new object inside the C code, and this
triggers a garbage collection?
When you create new objects in the C code, are they automatically
added to the 'current' scope, so that the GC sees them? If so, then
how does it know when to remove them from the scope, and if not, then
what would happen if a GC cycle was triggered during C code execution?

Thanks
PieSquared
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top