Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFI ruby object caching should be rewritten to not use id2ref #48

Closed
flavorjones opened this issue May 14, 2009 · 6 comments
Closed

FFI ruby object caching should be rewritten to not use id2ref #48

flavorjones opened this issue May 14, 2009 · 6 comments

Comments

@flavorjones
Copy link
Member

id2ref is slow and may be turned off by default in JRuby 1.4.

discussed with wmeissner, and the probable path is to build an API into FFI that is an hash table containing address => weakref(ruby_object).

@nicksieger
Copy link
Contributor

FYI, id2ref (and objectspace) is turned off by default in JRuby. We made a conscious decision to do this because it's expensive and not feasible to manage all live objects with JRuby.

@nicksieger
Copy link
Contributor

Also: tools to help implement the caching in Java/JRuby:

http://java.sun.com/javase/6/docs/api/java/lang/ref/WeakReference.html
http://java.sun.com/javase/6/docs/api/java/util/WeakHashMap.html

Note the last item may not be exactly what is needed, it's a map w/ weak keys, not a map that weakly references its values.

@flavorjones
Copy link
Member Author

Nick, thanks for the pointers (no pun intended).

@flavorjones
Copy link
Member Author

Charlie Nutter published weakling, a library for managing weakrefs efficiently on JRuby. Check out http://github.com/tenderlove/nokogiri/tree/weakling for the branch that uses it, and https://gist.github.com/8bec624e396812c4d00e for an explanation of why it isn't in master yet.

@tenderlove
Copy link
Member

I think we can close this one now, can't we?

@flavorjones
Copy link
Member Author

yes. weakling branch was merged into master.

flavorjones pushed a commit that referenced this issue Apr 7, 2021
Search for local includes in the current dir first, fixing missing error.h on clang/darwin
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants