Memory error: cannot allocate memory [How to Solve]

1. Problem background

Start a process, and the process reports an error: cannot allocate memory

2. Cause of problem

Check the script of this process. It is found that the script needs to call the memory of the system kernel to start, but the current kernel memory is not allocated.

3. Troubleshooting

1. View the remaining memory of the current physical machine

free -m

2. View the number of processes in the current system

# The maximum number of processes allowed in the system
sysctl kernel.pid_max

# The maximum number of processes on the current host
ps -eLf | wc -l

3. View memory application and availability

cat /proc/meminfo | grep Commit

4. Solution

Unable to allocate kernel memory

sysctl overcommit_memory=1

Read More: