-
Bug
-
Resolution: Fixed
-
P4
-
1.1.6
-
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.
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.