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

expandHandleSpace() can fail with out of handle space condition inappropriately

XMLWordPrintable

    • 1.2beta4
    • generic
    • solaris_2.5.1
    • Not verified

      There is a flaw in the garbage collector's code that deals with handles that
      I think bears scrutiny. It isn't a showstopper, but nevertheless
      should get some attention. The problem is described in detail below.

      The routine expandHandleSpace() in gc.c can fail with an out of handle space
      condition when there are still free handles in the system, or when it is still
      possible to get a block of handles.

      The routine expandHandleSpace() determines a factor by which it wants to increase handle space. This is done by the following two lines of code:

          incr = MIN_HANDLE_EXPANSION;
          incr = max(incr, preallocIncr);

      If preallocIncr is larger than MIN_HANDLE_EXPANSION, and the resultant value for
      incr is too large and will cause a heap overrun condition, the routine simply
      fails on out of memory without trying any smaller value (like MIN_HANDLE_EXPANSION).
      It seems to me that it would be appropriate to try a smaller allocation before
      failing, or at least trying to use MIN_HANDLE_EXPANSION before giving up. A
      fix is to allow the routine to try MIN_HANDLE_EXPANSION if preallocIncr was too
      big.

            hongzh Hong Zhang
            jbenoit Jonathan Benoit (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: