4

Using this tool, https://github.com/citygml4j/citygml-tools, which is called to-cityjson. I want to convert a cityGML file to a cityJSON file. The file is 4.36 GB, but i get the following error:

java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread main or

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at jdk.internal.reflect.GeneratedConstructorAccessor183.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at com.sun.xml.bind.v2.ClassFactory.create0(ClassFactory.java:102)
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.createInstance(ClassBeanInfoImpl.java:255)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:672)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:158)
    at com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:30)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$IntercepterLoader.startElement(ElementBeanInfoImpl.java:223)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:547)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:526)
    at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:45)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:216)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:150)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:385)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:356)
    at org.citygml4j.builder.jaxb.xml.io.reader.JAXBSimpleReader.nextFeature(JAXBSimpleReader.java:133)
    at org.citygml4j.tools.command.ToCityJSONCommand.execute(ToCityJSONCommand.java:133)
    at org.citygml4j.tools.CityGMLTools.handleParseResult(CityGMLTools.java:102)
    at org.citygml4j.tools.CityGMLTools.handleParseResult(CityGMLTools.java:35)
    at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526)
    at org.citygml4j.tools.CityGMLTools.main(CityGMLTools.java:44)

I found one solution, which would be to use java -Xmx15G, but i don't know how to implement it.

1
  • Unrelated to just OOME the OP knows how to fix it. It's about citygml-tools Commented Mar 20, 2019 at 13:27

4 Answers 4

2

You can use JAVA_OPTS or CITYGML_TOOLS_OPTS environment variable which is read by citygml-tools executable. Or you can modify the DEFAULT_JVM_OPTS option in the citygml-tools code:

# Add default JVM options here. You can also use JAVA_OPTS and CITYGML_TOOLS_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xms1G"'

If you are using Linux you can set in the terminal:

export JAVA_OPTS="-Xmx15G"
citygml-tools <file>
Sign up to request clarification or add additional context in comments.

2 Comments

I think this will work, but the computer shuts down after 10 minutes. Can this be because of not enough RAM memory (which is 4 GB, which is less than the file 4.36 GB)?
@karin if the computer is shutting down is most likely a software crash or overheating. You would have to debug it, no way to tell.
1

java -Xmx6144M -d64

Go to command line and execute this command, it will set it to 64 GB

Source: Increase heap size in Java

Comments

0

You can try a brute Force approach and assign a very large healthy space

Grep for the line

 defaultJvmOpts = ['-Xms1G'] 

only 1 GiB of heap space

Also make sure you are using a 64 bit Java and have enough ram

Comments

0

Buddy Another option if you are using eclipse is the following.

This worked for me, I hope it helps you (click over here).

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.