error='Cannot allocate memory' (errno=12)

Hello people!

Unfortnaly I have a problem with my JasperServer, but maybe you could be the one to help me out!

Every month there is one process that generates around 400 documents.

Last night this process again run and the JasperServer got a error:

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000d61b0000, 485883904, 0) failed; error='Cannot allocate memory' (errno=12)
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 485883904 bytes for committing reserved memory.

The JasperServer 7 is running on a Ubuntu 19.04 Vultr machine with 2048 MB of RAM.

Based on the JasperServer specs I would asume it's better to increase the amount of RAM and probably the allocate memory error will then also be fixed.

But I want to try to get this problem fixed without adding more ram to the server.

Would anyone have some tips for me on how to doing that?

Kind regards,'s picture
Joined: Jun 4 2019 - 10:15pm
Last seen: 1 month 1 week ago

What version are you running? 

But I doubt you'll get a better answer than to add memory.

djohnson53 - 3 years 7 months ago

We have jasper 7 running, is there not a way to limit the amount of memory that Java can use so this error wil not happen anymore? - 3 years 7 months ago

That's what you're doing now - limiting the memory available. That's why you're getting the error.

djohnson53 - 3 years 7 months ago
show 1 more...

Is there a way to fix this so we can stay on this amount of memory? Increasing it makes it more expensive and for only a few reports that does not make a lot of sense. - 3 years 7 months ago

3 Answers:

Looks like that one job to run 400 documents needs 485MB free to run.   I see you run 2048MB, but how much is free?

Is that  Ubuntu Vlutr running core minimalist without a GUI?

If not you could try disabling services but 2GB is pretty tight.    That's pretty out of the scope of this forum.

If you really wanted to pinch pennies, just split your report up.  Instead of one huge document run split it up into a number of smaller automated document runs.

(Change the criteria of your report by some factor to make it into something smaller to manage.)'s picture
Joined: Aug 29 2018 - 11:12am
Last seen: 2 years 1 month ago

There is also a Virtualizer for running large reports. We used this for generating large stock or calculation based reports within our ERP-System some years ago where some Reports runs took even several hours and not to run into the OutOfMemory we used the (GZip)Virturalizer logic - Worked fine when I remember right. ;-)

hth + regards


C-Box's picture
Joined: Jul 19 2006 - 5:58pm
Last seen: 5 months 1 week ago

Our system does 400 calls to the jasperserver to generate the reports so in this case I asume 400 jobs. We now tried to limit the java memory by 

export JAVA_OPTS="-Xms1536m -Xmx1536m -XX:PermSize=32m"

But I'm not sure if this will work?'s picture
Joined: Jun 4 2019 - 10:15pm
Last seen: 1 month 1 week ago