chewiebug / GCViewer

Fork of tagtraum industries' GCViewer. Tagtraum stopped development in 2008, I aim to improve support for Sun's / Oracle's java 1.6+ garbage collector logs (including G1 collector)
https://github.com/chewiebug/GCViewer/wiki
Other
4.47k stars 979 forks source link

The reported freed memory is incorrect #262

Open Kadri314 opened 2 years ago

Kadri314 commented 2 years ago

There are some cases, the GC pauses increase the memory heap size, example below:

[2022-08-23T14:36:33.337+0200][0.157s] GC(2) Pause Young (Normal) (G1 Evacuation Pause) 147M->148M(1028M) 7.903ms --> increased by 1mb

the GCVIWER in this case will do the following: before= 147 after=148 totalFreedMemory+=before - after ; --> in this case we subtract the totalFreedMemory by (1)

The solution should avoid adding into the totalFreedMemory when before-after is <0 : before= 147 after=148 diff= before - after totalFreedMemory+= diff >= 0 ? diff : 0

Please apply a fix to this issue, as the reported totalFreedMemory is incorrect.

Regards, Alkadri