? A desktop memory is 3G, but free has only 200M of memory and cannot meet the needs of Scala's JVM.
Note Use the top command to see the true free memory. Here's another command to see how much memory is actually used.
Watch-n 1 Cat/proc/meminfo
Search found that there are three ways to achieve the purpose of freeing memory.
Watch-n 1 free-m
Or
Free-m
The above method only increased by dozens of M.
sudo sysctl-w vm.drop_caches=3
The purpose of this method is to release the memory that kernel uses on the cache. increased by about 1G.
The following method releases more, but may affect the stability of the system! Be sure to use it carefully.
sudo sync && echo 3 | sudo tee/proc/sys/vm/drop_caches
This command releases either the memory in use or the cache (page cache, inodes, and Dentries), use carefully.
in general, the second method is more appropriate, if you need to run automatically once a few times, you can usecron jobs.
Release Ubuntu/linux system cache to increase available memory space