Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1259381

A Ref reachable in a cycle only reachable via the ref will not be cleared

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.4
    • Not verified

      [From mail from Alan Bishop:]

      Steve Heller has been thinking about changes to Ref tracing that affects
      this report, I think.

      From a Tue Jul 16 10:25:34 -0700 1996
      To: sbb, terryc
      CC: dlong, fresko
      Subject: Warning about refs


      There remains a problem with refs that probably won't get fixed for
      1.0.k. It might affect what cleanup you do at state transitions.

      If there is a subgraph of objects that is only reachable via a Ref,
      and there is a reference from one of the subgraph's objects back to
      the "subroot" (i.e. the object pointed to by the Ref), then the ref
      will never get cleared.

      I.e.


        +------+
        | Ref |
        +------+
          |
          V
        +------+
        | Obj |
        +------+
          |
          V
        +------+
        | Obj |
        +------+

      is ok, and the ref will get cleared.

      However,

        +------+
        | Ref |
        +------+
          |
          V
        +------+
        | Obj | <-----+
        +------+ |
          | |
          V |
        +------+ |
        | Obj | ------+
        +------+

      will not, as the cycle involving the "subroot" will convince the
      garbage collector that there's a hard ref and that clearing the soft
      one is a bad idea.

      If the cycle doesn't involve the subroot, then you're ok, i.e.

        +------+
        | Ref |
        +------+
          |
          V
        +------+
        | Obj |
        +------+
          |
          V
        +------+
        | Obj | <-----+
        +------+ |
          | |
          V |
        +------+ |
        | Obj | ------+
        +------+

            tlindholsunw Timothy Lindholm (Inactive)
            tlindholsunw Timothy Lindholm (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: