--mimepart_4d474c3db5c2c_59865a406be26cb
Content-Type: text/plain
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

Issue #4339 has been updated by Sean Bradly.

File ruby-1.8.7-trac22417.patch added

Fwiw, this resolves the issue for me. The general problem is that "structoad_arg arg" is on the stack AND wrapped by an RData. When GC starts, the RData refers to arg (a stack pointer) but the current (GC) thread's stack has clobbered this address. My fix simply switches arg to be dynamically allocated, and the same for mark_dump_arg. However, it appears this will leak a small amount of memory if Marshal throws an exception. This seems ok for my application, so I'm not going to look into it any more.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/4339

----------------------------------------
http://redmine.ruby-lang.org

--mimepart_4d474c3db5c2c_59865a406be26cb
Content-Type: text/x-patch; name=ruby-1.8.7-trac22417.patch
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename=ruby-1.8.7-trac22417.patch

LS0tIHJ1YnktMS44Ljctc3RvY2svbWFyc2hhbC5jCTIwMTAtMDYtMjMgMTA6
Mjg6MDQuMDAwMDAwMDAwIC0wNTAwCisrKyBydWJ5LTEuOC43LWJwcy1wMS9t
YXJzaGFsLmMJMjAxMS0wMS0zMSAxNjo1NTozNC4wOTY2Njc2NjAgLTA2MDAK
QEAgLTcyMyw3ICs3MjMsNiBAQAogICAgIGlmIChhcmctPnRhaW50KSB7CiAJ
T0JKX1RBSU5UKGFyZy0+c3RyKTsKICAgICB9Ci0KICAgICByZXR1cm4gMDsK
IH0KIApAQCAtNzYwLDkgKzc1OSwxMiBAQAogewogICAgIFZBTFVFIG9iaiwg
cG9ydCwgYTEsIGEyOwogICAgIGludCBsaW1pdCA9IC0xOwotICAgIHN0cnVj
dCBkdW1wX2FyZyBhcmc7CisgICAgc3RydWN0IGR1bXBfYXJnICphcmcgPSBt
YWxsb2Moc2l6ZW9mKHN0cnVjdCBkdW1wX2FyZykpOwogICAgIHN0cnVjdCBk
dW1wX2NhbGxfYXJnIGNfYXJnOwogCisgICAgaWYoIWFyZykKKyAgICAgICAg
cmJfb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