RFR: 8316305: Initial buffer size of StackWalker is too small caused by JDK-8285447

Mandy Chung mchung at openjdk.org
Thu Sep 14 21:20:39 UTC 2023


On Thu, 14 Sep 2023 20:42:57 GMT, Brent Christian <bchristi at openjdk.org> wrote:

>> A trivial fix.   [JDK-8285447](https://bugs.openjdk.org/browse/JDK-8285447) intends to change the initial batch size only for a stack walker with an estimated stack depth. For stack walkers without user-supplied estimated stack depth, the initial batch size is changed to 3 which is a bug.  This causes the stack walker to fetch the second batch after walking 2 frames.
>
> src/java.base/share/classes/java/lang/StackStreamFactory.java line 544:
> 
>> 542:                 return walker.estimateDepth() == 0
>> 543:                         ? SMALL_BATCH
>> 544:                         : Math.min(walker.estimateDepth() + RESERVED_ELEMENTS, LARGE_BATCH_SIZE);
> 
> Without the
> `Math.max(walker.estimateDepth()+RESERVED_ELEMENTS, MIN_BATCH_SIZE)`
> for estimateDepth = 1, I believe this will now return 2, where previously it returned 3.
> Is that OK?

yes as it's asked by the user.  It will fetch the second batch if it walks more than 1 frame.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15749#discussion_r1326524419


More information about the core-libs-dev mailing list