“This is the seventh day of my participation in the August More Text Challenge. For details, see: August More Text Challenge.”

The introduction

Today is the seventh day, got up very early, even if the weekend I also very diligent (SOB, is bitten by a mosquito woke up), wake up, don’t waste time, do truly valuable meaningful things, so I went out, and the liver the soft wen, the JVM series study already has 7, this paper introduces the contents of a lot of the JVM, From why to learn to know to understand, follow me, we will learn slowly, slowly digest, trust me you will love it (boasting doesn’t pay taxes anyway), no more gossip, today comes to lier OOM.

javaPile of abnormal

We mentioned before, the JVM is how to create and refer to our object, estimation is few remember buddy, it doesn’t matter, our purpose is to let a friend (from entry to give up, that is behind us learning will slowly in-depth, more systematic and comprehensive, hope is good for the reader, Of course, the style will not change. Come back,

OOM

We know that the Java object is stored in the heap, that if we don’t have life cycle object, continuously create incessantly created, what happens? That’s right, you will be blowing the JVM, the JVM is, of course, won’t let you get away with that, he will be thrown at the instant of the Fried abort execution of all programs, to avoid a wider range of damage, This is OOM.

Manual manufacturingOOM

The Java Virtual Machine Specification states that the Java heap is a discontinuous area of memory, that the Java heap is extensible (-xMX-XMS), and that an out of Memory error is thrown when the Java heap has no memory for instance allocation and that the heap cannot be expanded.

We can adjust the size of the heap by -xmx, -xms, such as 20M, and then continue to add objects on OOM, here a brief introduction, to see the voice of fans, we can seriously do, ha ha joke, a lot of time we want to listen to our inner voice.

How to analyze and solve

“Who likes horoscopes, tell me which star I need to fix?” how about OOM? The usual approach is to dump a snapshot and then use a memory analysis tool to analyze the memory. The primary goal is to find out whether the memory is leaking or out of memory.

A memory leak

If it is a memory leak, then we need to find out why the object is not recycled, and who is in the process of doing so. We can use the reference chain of GCroots to see how the leaked object is associated with it, and then find the reference information based on its type information to locate the specific location of the created object. Resolutely crack down on and prevent this kind of tax evasion!! For details, press the table first.

Out of memory

If it’s out of memory, look at our configuration to see if there’s room for upward adjustment for machine memory, and check if the code is living too long, holding state for too long, or is not designed properly.

digression

Yesterday recommended the video of study to my mother, she said it was very good, and slept very quietly……