On Tue, 12 Nov 2024 11:24:24 GMT, Shaojin Wen <s...@openjdk.org> wrote:

>> In the JDK code, there are some places that may cause Unsafe offset 
>> overflow. The probability of occurrence is low, but if it occurs, it will 
>> cause JVM crash.
>
> Shaojin Wen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   rename address to offset, from @AlanBateman

I want to add such a test case, but I am worried that it will consume too many 
resources during the build process.


/**
 * @test
 * @bug 8343984
 * @summary Test that the append capacity is close to Integer.MaxValue
 * @run main/othervm -Xms6g -Xmx6g HugeAppend
 */

public final class HugeAppend {
    public static void main(String[] args) {
        StringBuilder buf = new StringBuilder();
        int loop4 = Integer.MAX_VALUE / 4;
        for (int i = 0; i < loop4; i++) {
            buf.append(true);
        }

        buf.setLength(0);
        int loop5 = Integer.MAX_VALUE / 5;
        for (int i = 0; i < loop5; i++) {
            buf.append(false);
        }
    }
}

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

PR Comment: https://git.openjdk.org/jdk/pull/22027#issuecomment-2470377122

Reply via email to