fatal: Out of memory, malloc failed (tried to allocate 2282218975 bytes)
Asked by Alexander_Liebrecht:

Hello Community and DEvelopers,

I installed Atomicorp Linux Secure today and after uninstalling my Linux OS I was a little bit misconceived. If I do "sh start-confluence.sh -fg" I will see that.

```
Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /opt/atlassian/confluence/jre//bin/java
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000037f7d000000, 2555904, 1) failed; error='Operation not permitted' (errno=1)
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000353d5000000, 2555904, 1) failed; error='Operation not permitted' (errno=1)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmp/hs_err_pid67865.log
```

How can I solve the problem with Centos 7.4 and Confluence Server in the very last version?

Thanks in advance.

My previous solutions and what I found on Google unfortunately did not succeed. Therefore, I hope to find help here.

Alexander

P.S. Output of hs_err_pid67865.log is so:

```
Memory: 4k page, physical 65909196k(50194900k free), swap 8388604k(8388604k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.162-b12) for linux-amd64 JRE (1.8.0_162-b12), built on Dec 19 2017 21:15:48 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)

time: Wed May 30 15:19:56 2018
elapsed time: 0 seconds (0d 0h 0m 0s)
```


Answers:
author: Nic Brough -Adaptavist-
body: What have you got in setenv.sh (same directory as start-confluence.sh) for the -Xmx parameter?

Can you also try

cat /proc/memstat

on the box, and give us the first three lines? (Or MemTotal at least)

comments: author: Alexander_Liebrecht
body: ```
CATALINA_OPTS="-XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution ${CATALINA_OPTS}"
CATALINA_OPTS="-Xloggc:$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M ${CATALINA_OPTS}"
CATALINA_OPTS="-XX:G1ReservePercent=20 ${CATALINA_OPTS}"
CATALINA_OPTS="-Djava.awt.headless=true ${CATALINA_OPTS}"
CATALINA_OPTS="-Datlassian.plugins.enable.wait=300 ${CATALINA_OPTS}"
CATALINA_OPTS="-Xms2G -Xmx2G -XX:+UseG1GC ${CATALINA_OPTS}"
CATALINA_OPTS="-Dsynchrony.enable.xhr.fallback=true ${CATALINA_OPTS}"
CATALINA_OPTS="-Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 ${CATALINA_OPTS}"
CATALINA_OPTS="${START_CONFLUENCE_JAVA_OPTS} ${CATALINA_OPTS}"
CATALINA_OPTS="-Dconfluence.context.path=${CONFLUENCE_CONTEXT_PATH} ${CATALINA_OPTS}"
CATALINA_OPTS="-XX:ReservedCodeCacheSize=256m -XX:+UseCodeCacheFlushing ${CATALINA_OPTS}"
JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=1024m"
```


author: Nic Brough -Adaptavist-
body: And the memstat output?


author: Alexander_Liebrecht
body: Which directory do I have to execute the last SSH command from? Under "cd \~" the directory can not be found and under /opt/atlassian/confluence/bin either.

What am I doing wrong? Thank you.


author: Alexander_Liebrecht
body: free -m  
total used free shared buff/cache available  
Mem: 64364 6937 40221 545 17204 55986  
Swap: 8191


author: Nic Brough -Adaptavist-
body: Please try

cat /proc/memstat

on the box, and give us the first three lines? (Or MemTotal at least)


author: Alexander_Liebrecht
body: cat /proc/memstat  
cat: /proc/memstat: No such file or directory


author: Nic Brough -Adaptavist-
body: Hmm, sorry. How about

cat /proc/meminfo


author: Alexander_Liebrecht
body: ```
 cat /proc/meminfo
MemTotal: 65909196 kB
MemFree: 58934204 kB
MemAvailable: 59997852 kB
Buffers: 147448 kB
Cached: 1864088 kB
SwapCached: 0 kB
Active: 5337344 kB
Inactive: 997968 kB
Active(anon): 4414724 kB
Inactive(anon): 385612 kB
Active(file): 922620 kB
Inactive(file): 612356 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 8388604 kB
SwapFree: 8388604 kB
Dirty: 27464 kB
Writeback: 0 kB
AnonPages: 4323688 kB
Mapped: 690016 kB
Shmem: 476552 kB
Slab: 376760 kB
SReclaimable: 246132 kB
SUnreclaim: 130628 kB
KernelStack: 13616 kB
```


author: Alexander_Liebrecht
body: Hi,  
can not you help me anymore? I'm stuck, because all Google solutions already tried. I have already changed the values in setenv.sh to 8G. Still no success.


author: Nic Brough -Adaptavist-
body: Sorry, I missed the last update.

You've got 6Gb on the machine, and have given Confluence 2Gb max, so I don't know why it's failing to allocate 2Gb. I'm afraid I'm stuck, I've not seen a Tomcat do this before.

I'd be interested to see if Confluence runs ok with the plain default configuration though


author: Alexander_Liebrecht
body: Hi Nic,

Thanks for your Time and Hints. My Problem is solved.

A peculiar Linux security solution crashed my centos 7.5 rootserver and so java was also changed. I completely reinstalled the server and Java 8 was added. Of course, Confluence runs very well with the default configuration settings and I then reinstalled Confluence from scratch.

Everything good up here. Thank you for the help.


Tags: confluence-server

server