GC相關:java虛擬機(六)--垃圾收集器和內存分配策略 java虛擬機(五)--垃圾回收機制GChtml
-XX:+PrintGCDetailsjava
-XX:PrintGCTimestampslinux
-XX:PrintGCDateStamps服務器
-Xloggc:$CATALINA_HOME/logs/gc.log併發
-XX:+PrintHeapAtGCoracle
-XX:+PrintTenuringDistriution:發生GC的時候,把Young區中對象的年齡打印出來ui
其他的參數應該能直接看懂的,就不解釋了。阿里雲
PS:日誌中加的註釋下一行會錯位,請自行注意。spa
默認狀況下,都是使用Parallel收集器線程
JAVA_OPTS="-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:$CATALINA_HOME/logs/gc.log"
打開gc.log文件:
#虛擬機版本、jdk版本、Linux內核等 Java HotSpot(TM) 64-Bit Server VM (25.102-b14) for linux-amd64 JRE (1.8.0_102-b14), built on Jun 22 2016 18:43:17 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
#磁盤數據每頁4K,內存4G,1.7G屬於空閒 Memory: 4k page, physical 3880412k(1678252k free), swap 0k(0k free)
#打印命令:由於Parallel是自適應的,雖然沒有設置一些參數,可是根據服務器的內存、CPU等狀況就行分配。 CommandLine flags: -XX:InitialHeapSize=62086592 -XX:MaxHeapSize=993385472 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC #對象分配內存失敗,Young區發生GC,從15M-->2M,總17M,堆從15M-->4M,總58M,GC時間0.0074512s,Young區減小13M,堆只減小了11M,因此有2M對象到了Old區
2019-07-15T10:38:52.441+0800: 0.654: [GC (Allocation Failure) [PSYoungGen: 15360K->2544K(17920K)] 15360K->4022K(58880K), 0.0074512 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 2019-07-15T10:38:52.942+0800: 1.155: [GC (Allocation Failure) [PSYoungGen: 17904K->2554K(33280K)] 19382K->7383K(74240K), 0.0171215 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] 2019-07-15T10:38:53.359+0800: 1.572: [GC (Allocation Failure) [PSYoungGen: 33274K->2554K(33280K)] 38103K->11504K(74240K), 0.0143284 secs] [Times: user=0.02 sys=0.00, real=0.01 secs] 2019-07-15T10:38:53.500+0800: 1.713: [GC (Allocation Failure) [PSYoungGen: 33274K->2554K(64000K)] 42224K->14443K(104960K), 0.0129043 secs] [Times: user=0.02 sys=0.00, real=0.01 secs] 2019-07-15T10:38:53.788+0800: 2.000: [GC (Allocation Failure) [PSYoungGen: 63994K->2554K(64000K)] 75883K->23497K(104960K), 0.0179449 secs] [Times: user=0.03 sys=0.01, real=0.02 secs] 2019-07-15T10:38:54.041+0800: 2.253: [GC (Allocation Failure) [PSYoungGen: 63994K->11256K(131584K)] 84937K->33580K(172544K), 0.0177155 secs] [Times: user=0.02 sys=0.01, real=0.02 secs] 2019-07-15T10:38:54.500+0800: 2.713: [GC (Allocation Failure) [PSYoungGen: 131576K->13815K(134144K)] 153900K->43739K(175104K), 0.0276207 secs] [Times: user=0.03 sys=0.02, real=0.03 secs]
#Metaspace區發生GC,Young區發生GC,從115M-->10M,總258M,堆從145M-->40M,總299M,GC時間0.0227380 2019-07-15T10:38:55.513+0800: 3.726: [GC (Metadata GC Threshold) [PSYoungGen: 115110K->10443K(258560K)] 145034K->40823K(299520K), 0.0227380 secs] [Times: user=0.04 sys=0.00, real=0.02 secs]
#發生Full GC,由於Metaspace內存利用達到閥值,Old區也被回收了 2019-07-15T10:38:55.536+0800: 3.748: [Full GC (Metadata GC Threshold) [PSYoungGen: 10443K->0K(258560K)] [ParOldGen: 30380K->28896K(59392K)] 40823K->28896K(317952K), [Metaspace: 20720K->20720K(1069056K)], 0.0819349 secs] [Times: user=0.14 sys=0.00, real=0.09 secs] 2019-07-15T10:38:58.060+0800: 6.272: [GC (Allocation Failure) [PSYoungGen: 240640K->15826K(259584K)] 269536K->44730K(318976K), 0.0444735 secs] [Times: user=0.08 sys=0.01, real=0.04 secs] 2019-07-15T10:38:58.842+0800: 7.054: [GC (Metadata GC Threshold) [PSYoungGen: 113863K->8488K(303616K)] 142768K->37401K(363008K), 0.0197353 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] 2019-07-15T10:38:58.861+0800: 7.074: [Full GC (Metadata GC Threshold) [PSYoungGen: 8488K->0K(303616K)] [ParOldGen: 28912K->15427K(55296K)] 37401K->15427K(358912K), [Metaspace: 33955K->33955K(1081344K)], 0.1084317 secs] [Times: user=0.19 sys=0.00, real=0.11 secs]
-XX:+UseCompressedClassPointers使用CCS短指針
-XX:+UseCompressedOops:壓縮對象指針
-XX:+UseParallelGC:默認使用Parallel垃圾收集器,Server模式下
[Times: user=0.02 sys=0.00, real=0.01 secs] :分別表明用戶態消耗的CPU時間、內核態消耗的CPU時間、操做從開始到結束通過的牆鍾事件
CPU時間和牆鍾時間區別:
牆鍾時間包含多種非運算的等待耗時,例如等待磁盤IO、等待線程阻塞
CPU時間不包含這些耗時,多CPU或多核,會疊加這些CPU時間
Java HotSpot(TM) 64-Bit Server VM (25.102-b14) for linux-amd64 JRE (1.8.0_102-b14), built on Jun 22 2016 18:43:17 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8) Memory: 4k page, physical 3880412k(1677240k free), swap 0k(0k free)
#由於使用了CMS,因此Young區使用了ParNew,從參數能夠看出來:-XX:+UseConcMarkSweepGC -XX:+UseParNewGC CommandLine flags: -XX:InitialHeapSize=62086592 -XX:MaxHeapSize=993385472 -XX:MaxNewSize=174485504 -XX:MaxTenuringThreshold=6 -XX:OldPLABSize=16 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseParNewGC #剛開始爲Young區GC
2019-07-15T10:50:17.152+0800: 0.706: [GC (Allocation Failure) 2019-07-15T10:50:17.152+0800: 0.706: [ParNew: 16384K->2048K(18432K), 0.0116281 secs] 16384K->4234K(59392K), 0.0117284 secs] [Times: user=0.02 sys=0.00, real=0.01 secs] 2019-07-15T10:50:17.705+0800: 1.259: [GC (Allocation Failure) 2019-07-15T10:50:17.705+0800: 1.260: [ParNew: 18426K->2048K(18432K), 0.0166827 secs] 20612K->7790K(59392K), 0.0167603 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] 2019-07-15T10:50:17.964+0800: 1.518: [GC (Allocation Failure) 2019-07-15T10:50:17.964+0800: 1.518: [ParNew: 18432K->2048K(18432K), 0.0131088 secs] 24174K->11214K(59392K), 0.0131987 secs] [Times: user=0.03 sys=0.00, real=0.01 secs] 2019-07-15T10:50:18.087+0800: 1.641: [GC (Allocation Failure) 2019-07-15T10:50:18.087+0800: 1.641: [ParNew: 18432K->2048K(18432K), 0.0063598 secs] 27598K->12525K(59392K), 0.0064490 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 2019-07-15T10:50:18.171+0800: 1.725: [GC (Allocation Failure) 2019-07-15T10:50:18.171+0800: 1.725: [ParNew: 18432K->2047K(18432K), 0.0048486 secs] 28909K->13416K(59392K), 0.0049454 secs] [Times: user=0.00 sys=0.01, real=0.00 secs] 2019-07-15T10:50:18.253+0800: 1.807: [GC (Allocation Failure) 2019-07-15T10:50:18.253+0800: 1.807: [ParNew: 18431K->2048K(18432K), 0.0044206 secs] 29800K->14647K(59392K), 0.0044871 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 2019-07-15T10:50:18.351+0800: 1.905: [GC (Allocation Failure) 2019-07-15T10:50:18.351+0800: 1.905: [ParNew: 18432K->2048K(18432K), 0.0078141 secs] 31031K->15528K(59392K), 0.0078983 secs] [Times: user=0.02 sys=0.00, real=0.01 secs] 2019-07-15T10:50:18.438+0800: 1.992: [GC (Allocation Failure) 2019-07-15T10:50:18.438+0800: 1.992: [ParNew: 18432K->2048K(18432K), 0.0036144 secs] 31912K->15758K(59392K), 0.0036887 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 2019-07-15T10:50:18.500+0800: 2.054: [GC (Allocation Failure) 2019-07-15T10:50:18.500+0800: 2.054: [ParNew: 18432K->2047K(18432K), 0.0043671 secs] 32142K->16245K(59392K), 0.0044290 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 2019-07-15T10:50:18.574+0800: 2.128: [GC (Allocation Failure) 2019-07-15T10:50:18.574+0800: 2.128: [ParNew: 18431K->2048K(18432K), 0.0075469 secs] 32629K->16612K(59392K), 0.0076214 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 2019-07-15T10:50:18.632+0800: 2.186: [GC (Allocation Failure) 2019-07-15T10:50:18.632+0800: 2.186: [ParNew: 18432K->2048K(18432K), 0.0056882 secs] 32996K->16953K(59392K), 0.0057710 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 2019-07-15T10:50:18.700+0800: 2.254: [GC (Allocation Failure) 2019-07-15T10:50:18.700+0800: 2.254: [ParNew: 18432K->2047K(18432K), 0.0039387 secs] 33337K->17367K(59392K), 0.0039998 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 2019-07-15T10:50:18.769+0800: 2.323: [GC (Allocation Failure) 2019-07-15T10:50:18.769+0800: 2.323: [ParNew: 18431K->2048K(18432K), 0.0080793 secs] 33751K->18524K(59392K), 0.0081855 secs] [Times: user=0.02 sys=0.00, real=0.00 secs] 2019-07-15T10:50:18.841+0800: 2.395: [GC (Allocation Failure) 2019-07-15T10:50:18.841+0800: 2.395: [ParNew: 18432K->2047K(18432K), 0.0042404 secs] 34908K->19147K(59392K), 0.0043270 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 2019-07-15T10:50:18.903+0800: 2.457: [GC (Allocation Failure) 2019-07-15T10:50:18.903+0800: 2.457: [ParNew: 18431K->2048K(18432K), 0.0040362 secs] 35531K->19653K(59392K), 0.0040956 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 2019-07-15T10:50:18.962+0800: 2.516: [GC (Allocation Failure) 2019-07-15T10:50:18.962+0800: 2.516: [ParNew: 18432K->2039K(18432K), 0.0071315 secs] 36037K->19920K(59392K), 0.0072320 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 2019-07-15T10:50:19.035+0800: 2.589: [GC (Allocation Failure) 2019-07-15T10:50:19.035+0800: 2.589: [ParNew: 18423K->2048K(18432K), 0.0048979 secs] 36304K->20760K(59392K), 0.0049775 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 2019-07-15T10:50:19.101+0800: 2.655: [GC (Allocation Failure) 2019-07-15T10:50:19.101+0800: 2.655: [ParNew: 18432K->2048K(18432K), 0.0044687 secs] 37144K->21047K(59392K), 0.0045589 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 2019-07-15T10:50:19.164+0800: 2.718: [GC (Allocation Failure) 2019-07-15T10:50:19.164+0800: 2.718: [ParNew: 18432K->2048K(18432K), 0.0079322 secs] 37431K->21701K(59392K), 0.0080210 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 2019-07-15T10:50:19.235+0800: 2.789: [GC (Allocation Failure) 2019-07-15T10:50:19.235+0800: 2.789: [ParNew: 18432K->2048K(18432K), 0.0075261 secs] 38085K->22350K(59392K), 0.0076038 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 2019-07-15T10:50:19.303+0800: 2.857: [GC (Allocation Failure) 2019-07-15T10:50:19.303+0800: 2.857: [ParNew: 18432K->2048K(18432K), 0.0072659 secs] 38734K->22980K(59392K), 0.0073609 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] #Old區發生GC,爲FUll GC
#CMS初始標記,Old區爲20M,總的爲40M,堆區爲24M,總的爲59M
2019-07-15T10:50:19.317+0800: 2.871: [GC (CMS Initial Mark) [1 CMS-initial-mark: 20932K(40960K)] 24947K(59392K), 0.0020892 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
#併發標記 2019-07-15T10:50:19.320+0800: 2.874: [CMS-concurrent-mark-start]
#併發標記時間位0.41s 2019-07-15T10:50:19.361+0800: 2.915: [CMS-concurrent-mark: 0.041/0.041 secs] [Times: user=0.07 sys=0.01, real=0.04 secs]
#併發預清理 2019-07-15T10:50:19.361+0800: 2.915: [CMS-concurrent-preclean-start]
#時間爲0.001s 2019-07-15T10:50:19.362+0800: 2.916: [CMS-concurrent-preclean: 0.001/0.001 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
#可終止預清理 2019-07-15T10:50:19.362+0800: 2.916: [CMS-concurrent-abortable-preclean-start]
#發生Young GC 2019-07-15T10:50:19.369+0800: 2.923: [GC (Allocation Failure) 2019-07-15T10:50:19.369+0800: 2.923: [ParNew: 18432K->2047K(18432K), 0.0073641 secs] 39364K->23988K(59392K), 0.0074166 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] #可終止預清理時間位0.02s
2019-07-15T10:50:19.471+0800: 3.025: [CMS-concurrent-abortable-preclean: 0.020/0.109 secs] [Times: user=0.21 sys=0.00, real=0.11 secs] #從新標記
2019-07-15T10:50:19.477+0800: 3.031: [GC (CMS Final Remark) [YG occupancy: 14850 K (18432 K)]2019-07-15T10:50:19.477+0800: 3.031: [Rescan (parallel) , 0.0088998 secs]2019-07-15T10:50:19.486+0800: 3.040: [weak refs processing, 0.0004368 secs]2019-07-15T10:50:19.486+0800: 3.040: [class unloading, 0.0036209 secs]2019-07-15T10:50:19.490+0800: 3.044: [scrub symbol table, 0.0020465 secs]2019-07-15T10:50:19.492+0800: 3.046: [scrub string table, 0.0009907 secs][1 CMS-remark: 21940K(40960K)] 36790K(59392K), 0.0165922 secs] [Times: user=0.03 sys=0.01, real=0.02 secs] 2019-07-15T10:50:19.494+0800: 3.048: [CMS-concurrent-sweep-start] #併發清除時間位0.009s
2019-07-15T10:50:19.502+0800: 3.056: [CMS-concurrent-sweep: 0.009/0.009 secs] [Times: user=0.02 sys=0.00, real=0.01 secs] 2019-07-15T10:50:19.502+0800: 3.056: [CMS-concurrent-reset-start]
#併發重置時間位0.044s 2019-07-15T10:50:19.547+0800: 3.101: [CMS-concurrent-reset: 0.044/0.044 secs] [Times: user=0.06 sys=0.02, real=0.04 secs]
#發生Young區的GC 2019-07-15T13:43:43.100+0800: 3.463: [GC pause (G1 Evacuation Pause) (young), 0.0191098 secs] #並行的時間12.5 ms,GC工做線程爲2,個人阿里雲只是雙核的,下面的Min、Max和Avg是指啓動的這些工做線程的運行情況 [Parallel Time: 12.5 ms, GC Workers: 2] #GC開始的時間點 [GC Worker Start (ms): Min: 3463.2, Avg: 3464.5, Max: 3465.8, Diff: 2.6] #GC Root掃描的時間 [Ext Root Scanning (ms): Min: 0.3, Avg: 3.9, Max: 7.4, Diff: 7.1, Sum: 7.7] #更新RSet的時間 [Update RS (ms): Min: 0.0, Avg: 1.6, Max: 3.1, Diff: 3.1, Sum: 3.1] [Processed Buffers: Min: 0, Avg: 7.0, Max: 14, Diff: 14, Sum: 14] #掃描RSet的時間 [Scan RS (ms): Min: 0.0, Avg: 0.0, Max: 0.1, Diff: 0.1, Sum: 0.1] [Code Root Scanning (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.1] [Object Copy (ms): Min: 5.0, Avg: 5.6, Max: 6.3, Diff: 1.3, Sum: 11.2] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.1] [Termination Attempts: Min: 1, Avg: 1.0, Max: 1, Diff: 0, Sum: 2] [GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0] [GC Worker Total (ms): Min: 9.9, Avg: 11.2, Max: 12.5, Diff: 2.6, Sum: 22.4] [GC Worker End (ms): Min: 3475.7, Avg: 3475.7, Max: 3475.7, Diff: 0.0] [Code Root Fixup: 0.0 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.1 ms] [Other: 6.5 ms] [Choose CSet: 0.0 ms] [Ref Proc: 4.5 ms] [Ref Enq: 0.1 ms] [Redirty Cards: 0.0 ms] #就是存儲大對象的Region [Humongous Register: 0.0 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 0.1 ms] #Eden區回收67.0M,變成135.0M,Survivors區從5120.0K->9216.0K,堆區從92M到29.9M,而且總大小翻倍 [Eden: 67.0M(67.0M)->0.0B(135.0M) Survivors: 5120.0K->9216.0K Heap: 92.0M(120.0M)->29.9M(240.0M)] [Times: user=0.03 sys=0.00, real=0.02 secs] #堆佔有率達到InitiatingHeapOccupancyPercent,發生一次Mixed GC,會有global concurrent marking,時間爲0.0166952s 2019-07-15T13:43:44.072+0800: 4.435: [GC pause (Metadata GC Threshold) (young) (initial-mark), 0.0166952 secs] [Parallel Time: 12.5 ms, GC Workers: 2] [GC Worker Start (ms): Min: 4435.1, Avg: 4435.9, Max: 4436.8, Diff: 1.7] [Ext Root Scanning (ms): Min: 1.2, Avg: 2.1, Max: 2.9, Diff: 1.8, Sum: 4.1] [Update RS (ms): Min: 1.6, Avg: 1.7, Max: 1.7, Diff: 0.2, Sum: 3.3] [Processed Buffers: Min: 4, Avg: 7.5, Max: 11, Diff: 7, Sum: 15] [Scan RS (ms): Min: 0.0, Avg: 0.0, Max: 0.1, Diff: 0.0, Sum: 0.1] [Code Root Scanning (ms): Min: 0.2, Avg: 0.2, Max: 0.3, Diff: 0.1, Sum: 0.4] [Object Copy (ms): Min: 7.5, Avg: 7.6, Max: 7.7, Diff: 0.1, Sum: 15.2] [Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0] [Termination Attempts: Min: 1, Avg: 1.0, Max: 1, Diff: 0, Sum: 2] [GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0] [GC Worker Total (ms): Min: 10.7, Avg: 11.6, Max: 12.4, Diff: 1.7, Sum: 23.1] [GC Worker End (ms): Min: 4447.5, Avg: 4447.5, Max: 4447.5, Diff: 0.0] [Code Root Fixup: 0.1 ms] [Code Root Purge: 0.0 ms] [Clear CT: 0.1 ms] [Other: 4.1 ms] [Choose CSet: 0.0 ms] [Ref Proc: 3.7 ms] [Ref Enq: 0.0 ms] [Redirty Cards: 0.0 ms] [Humongous Register: 0.0 ms] [Humongous Reclaim: 0.0 ms] [Free CSet: 0.1 ms] [Eden: 83.0M(135.0M)->0.0B(135.0M) Survivors: 9216.0K->9216.0K Heap: 112.9M(240.0M)->29.4M(240.0M)] [Times: user=0.03 sys=0.01, real=0.02 secs]
#併發root Region掃描 2019-07-15T13:43:44.090+0800: 4.453: [GC concurrent-root-region-scan-start] 2019-07-15T13:43:44.104+0800: 4.467: [GC concurrent-root-region-scan-end, 0.0138623 secs]
#併發標記 2019-07-15T13:43:44.104+0800: 4.467: [GC concurrent-mark-start] 2019-07-15T13:43:44.166+0800: 4.529: [GC concurrent-mark-end, 0.0614277 secs]
#從新標記 2019-07-15T13:43:44.166+0800: 4.529: [GC remark 2019-07-15T13:43:44.166+0800: 4.529: [Finalize Marking, 0.0001259 secs] 2019-07-15T13:43:44.166+0800: 4.529: [GC ref-proc, 0.0001492 secs] 2019-07-15T13:43:44.166+0800: 4.529: [Unloading, 0.0067901 secs], 0.0072554 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 2019-07-15T13:43:44.179+0800: 4.542: [GC cleanup 37M->31M(240M), 0.0005559 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
#併發清除 2019-07-15T13:43:44.186+0800: 4.549: [GC concurrent-cleanup-start] 2019-07-15T13:43:44.186+0800: 4.549: [GC concurrent-cleanup-end, 0.0000283 secs]
當堆佔有率達到InitiatingHeapOccupancyPercent,發生一次Mixed GC,默認45%
# jinfo -flag InitiatingHeapOccupancyPercent 11833 -XX:InitiatingHeapOccupancyPercent=45
GC日誌能夠參考下面的地址:
CMS日誌格式:https://blogs.oracle.com/poonam/understanding-cms-gc-logs
G1日誌格式:https://blogs.oracle.com/poonam/understanding-g1-gc-logs
DefNew:default new generation
PSYoungGen:Parallel Scavenge generation
ParNew:Parallel New Generation
老年代和永久帶同理,名稱也是由收集器決定
Minor GC 對年輕代進行回
Major GC 是清理老年代
Full GC 是清理整個堆空間—包括年輕代和老年代