- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
发表于 2012-1-31 21:51:45
ODM Test:- SQL> show parameter sga_target
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- sga_target big integer 0
- SQL> show parameter shared_pool_size
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- shared_pool_size big integer 200M
- SQL> select * from v$version;
- BANNER
- ----------------------------------------------------------------
- Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
- PL/SQL Release 10.2.0.1.0 - Production
- CORE 10.2.0.1.0 Production
- TNS for Linux: Version 10.2.0.1.0 - Production
- NLSRTL Version 10.2.0.1.0 - Production
- SQL> oradebug setmypid;
- Statement processed.
- SQL> oradebug dump heapdump 536870914;
- Statement processed.
- SQL> oradebug tracefile_name;
- /s01/admin/G10R21/udump/g10r21_ora_3755.trc
- HEAP DUMP heap name="sga heap(1,0)" desc=0x600332a8
- extent sz=0xfe0 alt=216 het=32767 rec=9 flg=-126 opc=0
- FREE LISTS:
- Bucket 0 size=32
- Bucket 1 size=40
- Chunk 0802e99a8 sz= 40 free " "
- Chunk 0805fac20 sz= 40 free " "
- ......................
- Bucket 2 size=48
- Chunk 0803ec120 sz= 48 free " "
- Chunk 08051d580 sz= 48 free " "
- Chunk 0804d9670 sz= 48 free " "
- Chunk 0805cc008 sz= 48 free " "
-
- ................................
- Bucket 251 size=12360
- Chunk 08024c3f0 sz= 12496 free " "
- Bucket 252 size=16408
- Chunk 08026e088 sz= 16592 free " "
- Chunk 080256510 sz= 20480 free " "
- Chunk 081f8c4f0 sz= 24688 free " "
- Bucket 253 size=32792
- Bucket 254 size=65560
- Chunk 081f30f28 sz= 361928 free " "
- Chunk 08019bd80 sz= 714344 free " "
- Total free space = 1191752
复制代码 size > 65560bytes=64k chunks always stored in Bucket 254 , 空闲列表最大有0-254 共255个 Buckets(Heap free lists contain 255 buckets)
Each bucket contains double linked list to free chunks
Bucket sizes increase in
increments of 4 bytes - 16, 20, 24, 28, 32 ... 808, 812
increments of 64 bytes - 876, 940, 1004 ... 3948, 4012
then 4108, 8204, 16396, 32780, 65548
Reduces fragmentation- RESERVED FREE LISTS:
- Reserved bucket 0 size=32
- Reserved bucket 1 size=4400
- Reserved bucket 2 size=8216
- Reserved bucket 3 size=8696
- Reserved bucket 4 size=8704
- Reserved bucket 5 size=8712
- Reserved bucket 6 size=8720
- Reserved bucket 7 size=9368
- Reserved bucket 8 size=9376
- Reserved bucket 9 size=12352
- Reserved bucket 10 size=12360
- Reserved bucket 11 size=16408
- Reserved bucket 12 size=32792
- Reserved bucket 13 size=65560
- Chunk 080000088 sz= 212808 R-free " "
- Chunk 080400088 sz= 212808 R-free " "
- Chunk 080800088 sz= 212808 R-free " "
- Chunk 080c00088 sz= 212808 R-free " "
- Chunk 081000088 sz= 212808 R-free " "
- Chunk 081400088 sz= 212808 R-free " "
- Chunk 081800088 sz= 212808 R-free " "
- Chunk 081c00088 sz= 212808 R-free " "
- Total reserved free space = 4256160
复制代码 RESERVED FREE LISTS一般有14个Bucket- UNPINNED RECREATABLE CHUNKS (lru first):
- Chunk 083ffffc8 sz= 56 recreate "fixed allocatio" latch=0x600156a0
- Chunk 082bffd10 sz= 64 recreate "fixed allocatio" latch=0x82f4bfd0
- Chunk 0823ce0a8 sz= 56 recreate "fixed allocatio" latch=0x82f4bfd0
- Chunk 0823cce68 sz= 56 recreate "fixed allocatio" latch=0x82f4bfd0
- Chunk 0823caaa8 sz= 56 recreate "fixed allocatio" latch=0x82f4c110
- Chunk 0823ca6a0 sz= 56 recreate "fixed allocatio" latch=0x82f4c110
- Chunk 0823c98b8 sz= 56 recreate "fixed allocatio" latch=0x82f4c110
- Chunk 0823c74f8 sz= 56 recreate "fixed allocatio" latch=0x82f4c070
- Chunk 0823c72b0 sz= 56 recreate "fixed allocatio" latch=0x82f4c070
- Chunk 0823c6920 sz= 56 recreate "fixed allocatio" latch=0x82f4c110
- Chunk 0823c0410 sz= 56 recreate "fixed allocatio" latch=0x82f4c110
- Chunk 0823ba420 sz= 1112 recreate "KGLS heap " latch=0x82f4c110
- Chunk 0823bfd00 sz= 1112 recreate "Heap0: KGL " latch=0x82f4c110
- Unpinned space = 2957616 rcr=974 trn=1465
复制代码 1.recreate memory 是那些 已分配的内存,但是仍可以被age out到heap的Free List上
2.KGH heap manager 使用LRU算法来实现aging
3.chunk flag KGHACRECR用来标示 那些其内容 已经为recreatable的chunk
4. 当chunk不在被使用, chunk的用户可以显示地将它 unpin解锁掉,从而KGM Memory Manager会看到这个chunk成为潜在的Free Chunk
5. KGH 会调用已注册的回调程序(callback)来请求chunk的所有者将该chunk 释放Free掉
6. chunk的拥有者可以自行决定是否释放Free chunk
7. 被 "pinned"住的recreatable chunk无法aged out到Free List上
8. 所有未被锁住的Unpinned Recrateable chunk都被 暂存在堆heap的LRU LIST上
Recreatable chunk header - kghrc -> kernel generic heap memory manager recreatable chunk header
Chunk 0823ba420 sz= 1112 recreate "KGLS heap " latch=0x82f4c110
Oracle同样利用latch来限制 client 的callback对recreatable chunk的串行操作。 |
|