Skip to Content
Java 9 High Performance
book

Java 9 High Performance

by Mayur Ramgir, Nick Samoylov
November 2017
Intermediate to advanced
398 pages
10h 14m
English
Packt Publishing
Content preview from Java 9 High Performance

Out of memory: kill process or sacrifice child

This error is thrown by the operating system. The operating system has processes which are governed by various kernel jobs. One of these jobs is out of memory killer. This job monitors the low memory situation and kills the rogue process which is consuming more memory resources. See the following example, which runs a loop and adds int array to a list. Eventually, you will get this error. Please note that you may need to tweak the swap file and heap sizes on your system:

import java.util.ArrayList;import java.util.List;public class KillProcess {        public static void main(String[] args){        List<int[]> myArrayList = new ArrayList();        KillProcess kp = new KillProcess(); kp.processKillLoop(myArrayList); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Distributed Computing in Java 9

Distributed Computing in Java 9

Raja Malleswara Rao Malleswara Rao Pattamsetti
Mastering Java 11 - Second Edition

Mastering Java 11 - Second Edition

Dr. Edward Lavieri Jr., Mandar Jog
Java EE 8 High Performance

Java EE 8 High Performance

Romain Manni-Bucau
Clojure: High Performance JVM Programming

Clojure: High Performance JVM Programming

Eduardo Díaz, Shantanu Kumar, Akhil Wali

Publisher Resources

ISBN: 9781787120785Supplemental Content