2

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.

trincot
  • 317,000
  • 35
  • 244
  • 286
karin
  • 33
  • 1
  • 1
  • 6

4 Answers4

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>
Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
  • 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 Mar 20 '19 at 14:10
  • @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. – Karol Dowbecki Mar 20 '19 at 14:12
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

Danyal Sandeelo
  • 12,196
  • 10
  • 47
  • 78
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

Dr Phil
  • 833
  • 6
  • 18
0

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

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

  • 2
    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](/help/how-to-ask). – Community Sep 13 '21 at 22:26