Out of memory error

(m m) #1

Hi, I get out of memory error when I run jibx binding for more number of classes. I have set gradle jvm arge to high value -Xmx1024m.

But since I am executing the jibx bind as an ant task ( i presume this works similar to javaexec task ) , would it possible to specify memory arguments to the ant task seperately ?

target.ant {
      taskdef(name:'jibxBind', classname: 'org.jibx.binding.ant.CompileTask', classpath: target.configurations.bind.asPath)
      jibxBind(binding:"${target.projectDir}/src/main/resources/bindgen/$bindGenFolder/binding.xml", classpath: target.sourceSets.main.output.classesDir)


(Szczepan Faber) #2

project.ant works in-process so in order to get it more memory you need to set more memory to Gradle (for example, via gradle.properties file and org.gradle.jvmargs=…)

If you want to execute ant process in a forked mode I think that the only reasonable solution is an exec task that calls out to ‘ant’.

Hope that helps!

(m m) #3

I have already a set a good memory ( -Xmx1024m ) in org.gradle.jvmargs

Can you please provide the link to document/example ,if available, on how to execute ant in forked mode ?

(René Groeschke) #4

There is no flag for running any ant task from gradle in forked mode and the binding compiler does not support running in forked mode I think. I would suggest to use an gradle JavaExec task to run the binding compiler. This can look like this:

task compileBindings(type: JavaExec){
    classpath = path/to/jibx-bind.jar
    main = "org.jibx.binding.Compile"
    arguments "/path/to/your/binding.xml"
    maxHeapSize = "1024m" // adjust as necessary



(m m) #5

Thanks. It worked.