JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-1962

ObjectProxyCache is not as effective with weakrefs, but eats too much memory with softrefs

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Java Integration
    • Labels:
      None
    • Number of attachments :
      0

      Description

      We had to switch the ObjectProxyCache from using weakrefs to softrefs, because softrefs weren't soft enough and the cache ended up eating too much memory. But weakrefs are likely to cause cache entries to be collected before they're ever used, so the new cache isn't helping much.

      We need a solution somewhere in the middle so the cache is useful but doesn't bloat to an unreasonable size.

        Issue Links

          Activity

          Hide
          Charles Oliver Nutter added a comment -

          This is getting bumped to post 1.1 since it works ok now (maybe not great, but ok) and there's a big Java integration reboot coming.

          Show
          Charles Oliver Nutter added a comment - This is getting bumped to post 1.1 since it works ok now (maybe not great, but ok) and there's a big Java integration reboot coming.
          Hide
          Charles Oliver Nutter added a comment -

          Marking as related to 2904, since a "better solution" would presumably not need to involve weakrefs (or else it wouldn't be much better).

          Show
          Charles Oliver Nutter added a comment - Marking as related to 2904, since a "better solution" would presumably not need to involve weakrefs (or else it wouldn't be much better).
          Hide
          Charles Oliver Nutter added a comment -

          Bill's email from some time ago talking about this problem:

          http://jira.codehaus.org/browse/JRUBY-199?focusedCommentId=119902#action_119902

          Show
          Charles Oliver Nutter added a comment - Bill's email from some time ago talking about this problem: http://jira.codehaus.org/browse/JRUBY-199?focusedCommentId=119902#action_119902
          Hide
          Charles Oliver Nutter added a comment -

          I don't see a way that SoftReference will ever work as a mechanism for ObjectProxyCache. It's simply too sticky to use for caching wrappers that may be created by the thousands. WeakReference is not as effective at caching, but we're only talking about lookups at the boundary between Ruby and Java, and if the wrapper is still referenced the WeakReference won't ever deref prematurely.

          Marking as WONTFIX.

          Show
          Charles Oliver Nutter added a comment - I don't see a way that SoftReference will ever work as a mechanism for ObjectProxyCache. It's simply too sticky to use for caching wrappers that may be created by the thousands. WeakReference is not as effective at caching, but we're only talking about lookups at the boundary between Ruby and Java, and if the wrapper is still referenced the WeakReference won't ever deref prematurely. Marking as WONTFIX.

            People

            • Assignee:
              Charles Oliver Nutter
              Reporter:
              Charles Oliver Nutter
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: