from space and to space size is different and varies

Jon Masamitsu jon.masamitsu at oracle.com
Mon Oct 29 07:46:24 PDT 2012



On 10/26/2012 1:32 AM, Thomas Rohde wrote:
> Hi Charlie,
>
> thanks for your reply. I could reproduce this with
> -XX:+UseAdaptiveSizePolicy and Java 1.7.
>
> My misbelief that from space and to space are always the same size.
> Thought that -XX:+UseAdaptiveSizePolicy would change both of them in the
> same manner.

UseAdaptiveSizePolicy changes them both at the same time if it
can.  Excuse the ascii art.

+==========+
|unused area|
+==========+
| from-space|
+==========+
| to-space  |
+==========+
| eden      |
+==========+

The space for expansion is above from-space.  from-space
typically has live data in it.  from-space can be expanded into
the unused area but to-space cannot (the live data in
from-space has to stay where it is).  After the next collection
the roles of from-space and to-space are switched and
the "new" from-space (the former to-space) can be expanded into
  the unused area. This means it takes a collections or two for an 
expansion to
take effect.  It could have been done other ways.  This is how
it is currently done.

Jon



> Thanks!
> Thomas
>
>
> Am 25.10.2012 14:23, schrieb Charlie Hunt:
>> Hi Thomas,
>>
>> It is common for Parallel GC, and Parallel Old GC to adjust survivor sizes when -XX:+UseAdaptiveSizePolicy is enabled.  And, -XX:+UseAdaptiveSizePolicy is enabled by default with either -XX:+UseParallelGC and -XX:+UseParallelOldGC, (iirc, the latter is not available in a Java 5 HotSpot VM).
>>
>> If you disable adaptive size policy, via -XX:-UseAdaptiveSizePolicy, survivor sizes should remain the same size.
>>
>> hths,
>>
>> charlie ...
>>
>> On Oct 25, 2012, at 3:47 AM, Thomas Rohde wrote:
>>
>>> Hi Folks,
>>>
>>> up to yesterday I always thought, that from-space and to-space have
>>> always the same size. In a GC log of a colleague I saw the following and
>>> was wondering about it:
>>>
>>> 22.10.2012 00:01:59 {Heap before gc invocations=590:
>>> 22.10.2012 00:01:59  PSYoungGen      total 72768K, used 70928K
>>> [0xcdc00000, 0xd3800000, 0xf8800000)
>>> 22.10.2012 00:01:59   eden space 54528K, 100% used
>>> [0xcdc00000,0xd1140000,0xd1140000)
>>> 22.10.2012 00:01:59   from space 18240K, 89% used
>>> [0xd1460000,0xd2464168,0xd2630000)
>>> 22.10.2012 00:01:59   to   space 18048K, 0% used
>>> [0xd2660000,0xd2660000,0xd3800000)
>>> 22.10.2012 00:01:59  PSOldGen        total 1400832K, used 334889K
>>> [0x78400000, 0xcdc00000, 0xcdc00000)
>>> 22.10.2012 00:01:59   object space 1400832K, 23% used
>>> [0x78400000,0x8cb0a778,0xcdc00000)
>>> 22.10.2012 00:01:59  PSPermGen       total 20480K, used 19997K
>>> [0x74400000, 0x75800000, 0x78400000)
>>> 22.10.2012 00:01:59   object space 20480K, 97% used
>>> [0x74400000,0x75787568,0x75800000)
>>> 22.10.2012 00:01:59 299113.923: [GC [PSYoungGen: 70928K->15357K(72512K)]
>>> 405818K->350331K(1473344K), 0.0717791 secs]
>>> 22.10.2012 00:01:59 Heap after gc invocations=590:
>>> 22.10.2012 00:01:59  PSYoungGen      total 72512K, used 15357K
>>> [0xcdc00000, 0xd3800000, 0xf8800000)
>>> 22.10.2012 00:01:59   eden space 54464K, 0% used
>>> [0xcdc00000,0xcdc00000,0xd1130000)
>>> 22.10.2012 00:01:59   from space 18048K, 85% used
>>> [0xd2660000,0xd355f7d8,0xd3800000)
>>> 22.10.2012 00:01:59   to   space 18112K, 0% used
>>> [0xd14a0000,0xd14a0000,0xd2650000)
>>> 22.10.2012 00:01:59  PSOldGen        total 1400832K, used 334973K
>>> [0x78400000, 0xcdc00000, 0xcdc00000)
>>> 22.10.2012 00:01:59   object space 1400832K, 23% used
>>> [0x78400000,0x8cb1f778,0xcdc00000)
>>> 22.10.2012 00:01:59  PSPermGen       total 20480K, used 19997K
>>> [0x74400000, 0x75800000, 0x78400000)
>>> 22.10.2012 00:01:59   object space 20480K, 97% used
>>> [0x74400000,0x75787568,0x75800000)
>>> 22.10.2012 00:01:59 }
>>>
>>> Before GC from space has 18240K and to space has 18048K.
>>> After GC from space has 18048K and to space has 18112K.
>>>
>>> java version "1.5.0_20"
>>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02)
>>> Java HotSpot(TM) Server VM (build 1.5.0_20-b02, mixed mode)
>>>
>>> 1. Why is the size of from space and to space not equal?
>>> 2. Why is the size always changing?
>>>
>>> Bye,
>>> Thomas
>>> _______________________________________________
>>> hotspot-gc-use mailing list
>>> hotspot-gc-use at openjdk.java.net
>>> http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
>


More information about the hotspot-gc-use mailing list