Ballerina-lang: Ballerina thows java.lang.OutOfMemoryError: Java heap space

Created on 3 Oct 2018  路  3Comments  路  Source: ballerina-platform/ballerina-lang

Description:
ballerina throws this error during run time

java.lang.OutOfMemoryError: Java heap space
Dumping heap to /usr/lib/ballerina/ballerina-0.981.0/heap-dump.hprof ...
Unable to create /usr/lib/ballerina/ballerina-0.981.0/heap-dump.hprof: Permission denied
error: error, message: java heap space
    at main(hello_word.bal:12)

Steps to reproduce:

Simply run this

 string s = "ssssssssssssssssssssssssssssssss";
   while(true) {
           s += s;
   }

Affected Versions:

Ballerina 0.981.0

OS, DB, other environment details and versions:

Ubuntu 16.06 LTS

AreJVMCodeGen TypBug

All 3 comments

Can throw internal bvm runtime error instead ? and possibility of adding something java like -Xms -Xmx?

As you can see from the part below, a Ballerina runtime error is given for that.

error: error, message: java heap space
    at main(hello_word.bal:12)

But the problem with the rest of the error output is it seems that is printed to stdout by the JVM as soon as the out of memory error occurs. To get rid of that output, we have to manage what's written to stdout and stderr (i.e., using System.setOut() and System.setErr()).

Hi,
We cannot avoid the initial part of the heap-dump related error message since it is getting printed by Java when the heap dumps are enabled.

We do catch the throwable errors that include OutOfMemoryError. I have change the wording to replace Java with runtime.

Thanks

Was this page helpful?
0 / 5 - 0 ratings