Skip to content

Eliminate usage of ObjectSpace._id2ref #63

Merged
merged 1 commit into from Jun 25, 2011

2 participants

@evanphx
evanphx commented Jun 24, 2011

Two reasons not to use _id2ref:
1) It's slow on other ruby implementations
2) It introduces a hidden bug because _id2ref can return any random
future object since object ids are recycled

@evanphx evanphx Eliminate usage of ObjectSpace._id2ref
Two reasons not to use _id2ref:
1) It's slow on other ruby implementations
2) It introduces a hidden bug because _id2ref can return any random
   future object since object ids are recycled
7deeb9c
@btakita btakita merged commit 1385208 into btakita:master Jun 25, 2011
@btakita
Owner
btakita commented Jun 25, 2011

I think the BoundObjects will need to be cleared in RR.reset.

I was under the assumption there would have been no bug since there was still a reference to the object (thus the object_id would not have changed) until RR.reset was called. Now I'm curious, is that correct?

But yeah, it makes sense to keep a separate hash if it's going to be slow.

Thanks,
Brian

@evanphx
evanphx commented Jun 25, 2011

I didn't see where there would be an object referenced until RR.reset, so I dunno. But thats another good reason to not use #_id2ref, namely that there is a hidden behavior here that is very easy to miss and potentially screw up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.