0

We are using ImageMagick launched by a JBoss EJB by the way of im4Java, to produce image files. im4Java is an Java interface to imagemagick, launching external process with java.lang.ProcessBuilder. After few successfull runs, we are blocked by a : java.io.IOException: Cannot run program "/usr/local/bin/convert": java.io.IOException: error=12, Cannot allocate memory

It seems not to be an ImageMagick issue, because if we launch the same process from command line, it runs perfectly. But more a Jboss memory allocation for an external process.

Any idea ?

Cédric NICOLAS
  • 1,006
  • 2
  • 12
  • 24
  • See http://stackoverflow.com/questions/1124771/how-to-solve-java-io-ioexception-error-12-cannot-allocate-memory-calling-run – Ivan Dec 28 '11 at 14:52
  • Do you have any environment variables that affects this programs allocation behavior on your setting, or maybe a configuration file that it reads from its search path? Using ProcessBuilder or Runtime.exec both spawns your program in a clean env and if you need the program to run from a certain directory you have to specify that. So check this and update the question we might be able to help more. – MahdeTo Dec 28 '11 at 14:52

1 Answers1

0

Finally solved, but maybe not the best way. Indeed , we have used the solution of the overcommit_memory variable in Linux indicated by Ivan, and no problem any more. But we are not sure changing that this memory global settings would not affect the whole behavior of the system later, as it seems to allocate a lot more memory. Hopefully we do not run so often imagemagick from java code, so memory is released once imagemagick did his job.

Cédric NICOLAS
  • 1,006
  • 2
  • 12
  • 24