Skip to content
Snippets Groups Projects
Commit 54a11707 authored by Lars Kanis's avatar Lars Kanis
Browse files

Discard borrowed object wrappers after method calls into Ruby.

This solves crashes of kind:
	[BUG] rb_gc_mark(): 0x00000003f54af8 is T_ZOMBIE

All parameters to Ruby event blocks or overloaded methods are converted to
proper Ruby classes or wrapped by appropriate wrapper classes for borrowed
objects. The wrapper classes are registered, to keep the connection between
C-pointer (the borrowed object) and the wrapping Ruby object. This connection
is canceled either when the borrowed object is destroyed or the Ruby wrapper
is free'd. If neither of them happens, the wrapper object is re-used for the
next call.

This worked good with Ruby-1.8, which has one big mark and sweep run.
Ruby-2.2 introduced incremental GC and has several mark and sweep runs, so
that marks and sweeps are quite independent. Therefor we re-used objects,
that are already maked for sweeping (so called T_ZOMBIE).

This patch releases the connection between borrowed object and it's wrapper
object after each call into Ruby code. Therefore the wrapper object isn't
re-used, but a new one is created for each param to each call. The wrapper
objects are later free'd by the GC. This patch could have a negative
performance impact.
parent 347966fc
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment