简体   繁体   中英

Java Garbage Collector Issues, Multiple Full GC in a short

Currently we are having massive problems with memory on our servers. They run out of memory in under an hour sometimes. We have a 256gb server and a E5-1650 v3 Hexa-Core from hetzner. Here is the garbage collection log. https://pastebin.com/7NUEGQs1 public void run(){} It made me put code here even though this question is about memory leaks and garbage collection

I don't think it ever clears any objects from the old generation, AND why the hell is the allocated memory going down from 10gb to 9.3gb when its literally starving.

I have tried everything to fix this, I even reset my server to factory default and reinstalled everything. It could be a memory leak I don't know. This seems incredibly strange even if it's a memory leak. it should never run that many full gcs that quickly.

Also another thing we noticed is when we stop one server, the other 3 begin to crash as well. Could this be a ram problem since each of the four servers is allocating 8-10 gb.

does this mean that no old gen objects are being deleted?

3978.597: [Full GC (Ergonomics) [PSYoungGen: 1165312K->647763K(2330112K)] [ParOldGen: 6990613K->6990765K(6990848K)] 8155925K->7638529K(9320960K), [Metaspace: 41441K->41441K(1087488K)], 3.7144066 secs] [Times: user=34.89 sys=0.09, real=3.71 secs]

regardless of my applications something must be very wrong for it to clear 150kb out of 6gb of old gen data right?

ParOldGen: 6990613K->6990765K(6990848K)

The other answer is perfectly correct, but it doesn't reflect some untrue assumptions you stated:

When a young evacuation is processed objects are visited through references starting from the roots to find out unreachable ones.

No, the unreachable ones won't get ever reached. That's the key to efficiency, as most newly created objects are unreachable when the GC runs. It only deals with reachable objects, copies them to a Survivor Space and what's left is free memory. The GC has no idea how many unreachable objects it's left behind. It simply doesn't care.

Actually, the "garbage collector" should be called "non-garbage rescuer" as that's what it does

As a result, ALL objects are considered, including objects allocated in Old Generation are also visited and marked if they are reachable.

No. Unreachable objects in Eden and Survivor Spaces won't ever get touched(*).

Objects in the Old Generation get only touched if they're in the remembered sets as Holger explained. This includes also unreachable objects in the Old Generation, as during a minor GC we don't know which old objects are still reachable (usually, most of them are).

As I understand reclaiming Young Generation and Old Generation at once is demanding because these generations are located in different contiguous parts of memory.

No. Major GC is demanding as the Old Generation is big.


(*) Objects implementing finalize or extending Reference need special handling when they become unreachable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM