Skip to content

Surefire complaints "java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects" #693

@lacgit

Description

@lacgit

When I run "mvn compile install", surefire throw out the captioned error, intermittently. I have tried several different version of mvn, and changing different numbers of the -Xmx4096m parameters. The results is the same, intermittently show up this error. Usually, the first git clone is ok, but not always. The second time onward will fire up this error consistently. This happens regardless of my Windows 10 or Ubuntu environments. "mvn clean" didn't help neither.

So I finally nailed down to the following few lines of code inside the SoftHashMapTests.extendedTests():
final Collection<byte[]> values = map.values();
for (byte[] value : values) {
assertTrue(map.containsValue(value));
}
for (final Entry<String, byte[]> entry : map.entrySet()) {
assertTrue(keySet.contains(entry.getKey()));
assertTrue(values.contains(entry.getValue()));
}

If I skip the two for loops, including the assignment to values, then mvn compile install can be successful consistently.
I peek the size() of the map, its only 10, so I have no clue of it causes.

Without the for loops, I can revert to -Xmx2048m with success as well.

In Ubuntu, I need to comment out the whole extendedTests() in order to bypass this error and compile install successfully.

I haven't figure out the cause. I hope the experts in here can shade some light.

So I comment out the for loops for now and proceed.

Thanks in advance and regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions