How do I know how much memory is reclaimed in major GC?
Thomas Schatzl
thomas.schatzl at oracle.com
Mon Jul 8 09:43:47 UTC 2019
Hi,
On Thu, 2019-06-27 at 21:32 +0000, shang xinli wrote:
> Hi all,
>
> I know young GC and full GC logs show that information like xxx->yyy.
> But in the major GC log, I can only see that information in 'initial
> mark' and 'final mark', but not in 'sweep'. So do I know in the end
> of a major GC, how much memory in the old generation is claimed? The
> logs are copied below.
>
> 2019-06-27T17:23:18.139+0000: 4910103.818: [GC (CMS Initial Mark) [1
> CMS-initial-mark: 153077851K(192937984K)] 163324888K(208037504K),
> 0.4523961 secs] [Times: user=9.72 sys=0.00, real=0.45 secs]
>
> [...]
>
> 2019-06-27T17:24:52.150+0000: 4910197.830: [GC (CMS Final Remark) [YG
> occupancy: 11527850 K (15099520 K)]2019-06-27T17:24:52.150+0000:
> 4910197.830: [Rescan (parallel) , 0.4904597 secs]2019-06-
> 27T17:24:52.641+0000: 4910198.320: [weak refs processing, 0.0000493
> secs]2019-06-27T17:24:52.641+0000: 4910198.320: [class unloading,
> 0.0275684 secs]2019-06-27T17:24:52.668+0000: 4910198.348: [scrub
> symbol table, 0.0065112 secs]2019-06-27T17:24:52.675+0000:
> 4910198.354: [scrub string table, 0.0010931 secs][1 CMS-remark:
> 153467633K(192937984K)] 164995484K(208037504K), 0.5259280 secs]
> [Times: user=11.21 sys=0.00, real=0.53 secs]
Sweep does not reevalute the heap, looking for newly reclaimable
memory. It only removes the unnecesssary memory found to be dead during
Final mark. I.e. you need to look at Final Mark (vs. Initial Mark) to
get an idea how much of the old generation has been reclaimed.
The "[1 CMS-initial-mark: 153077851K(192937984K)]" and "[1 CMS-remark:
> 153467633K(192937984K)]" give old gen usage/occupancy.
Note that allocation between initial and final mark (either direct or
during GCs) also changes the occupancy in the old gen, so you can't
directly subtract the values.
This is the most accurate way of getting this data from the logs I can
think of though.
Thanks,
Thomas
More information about the hotspot-gc-dev
mailing list