Shared Pool Series two: free lists/shared pool LRU List

Source: Internet
Author: User
Tags character set requires reserved

Describes the free lists and shared pool LRU list.

Allocation of chunk in Shared pool

1, the size of the chunk in the shared pool is not the same, but is continuous

2, because chunk is the smallest unit allocated, so the session needs to allocate space for the object, will be chunk for the unit to apply

3, available chunk (free) will form a linked list feee lists, easy to distribute, you can traverse the list to find available suitable chunk, linked list is chunk organization and management of a way

4, an available chunk linked list is a bucket,shared pool will have a lot of bucket, different bucket chunk size is different, generally with the increase of bucket number and growth

5. When you need to look for chunk from shared pool, first locate a bucket and then traverse bucket to find the most appropriate chunk, if the chunk space is larger than the space required, then this chunk split into two, one is assigned, One becomes free and bucket on the corresponding size.

6, in the process of looking for chunk, if there is no suitable chunk in a bucket, then look for another non-empty bucket, if all bucket do not have the appropriate chunk, then from the Rec type of the list to free part of the space, for the Or make a proper merge of free. Note: Only the rec type of chunk can be freed, even if the space is freed, these spaces may not be contiguous, are some very small chunk, which may create a situation where there is space in the shared pool but a large number of very small chunk, It's also hard to find the right chunk--shared pool fragment when looking for chunk

7. All types of chunk in shared pool are managed in the form of a linked list


Free list Idle lists

Divided by bucket, total 255, bucket 0---bucket 254

There is a chunk list on each bucket, free lists on the free chunk--status free

distribution of bucket size on free lists: --Environment Linux 32-bit/oracle

Bucket size is incremented by 4bytes before Bucket 0-199

Bucket 200-239 The Bucket size of this section is incremented by 64bytes

Bucket 240--254 Bucket size growth does not appear to be too much law, in short, the increase of haha.

Because the number of free chunk is very large, this reduces the number of chunk that each bucket accommodates, increases the lookup efficiency, and reduces the contention for shared pool latch considerably. Note: If there is a large number of free chunk in the shared pool, the share pool latch contention will occur, and this problem will occur over time even if the shared pool is increased in size.


RESERVED free lists on the number of bucket I dump out of 15.

Keep free LISTS to find the idle chunk in the reserved/LISTS when the SQL statement requires chunk greater than 4400bytes.

If the SQL statement requires a chunk of less than 4400bytes, only the chunk is found in the free list.

This is controlled by the implied parameters: _shared_pool_reserved_min_alloc minimum allocation size in bytes for reserved area, default value 4400


DUMP Shared pool View free lists/bucket/reserved free lists structure:--to do with a new session

Alter session SET Events ' immediate trace name heapdump Level 2 ';

Select value from V$diag_info where name like ' de% ';


To view the contents of the trace file:--Find this section of the method: VI Search Heap DUMP

Chunk 2bffa844 sz= 22460 freeable "character Set M"

Total heap Size = 146798680--146798680/1024/1024--139.99813 initialization parameter: shared_pool_size--140m

Free LISTS:------Idle columns, you can clearly see the bucket size distribution rules-from small to large, a total of 255 buckets, from 16bytes to 64k, the use of this method to allocate memory, can effectively reduce memory fragmentation. Each bucket is connected to each other with a double linked

Bucket 0 size=16

Chunk 2bc00048 sz= 0 kghdsx

Bucket 1 size=20 20 bytes of Bucket 1, there are a lot of chunk, save space omitted

Chunk 23a60468 sz= Free ""

Address, size, status of Chunk

Chunk 23ceb498 sz= Free ""

Chunk 237fcde4 sz= Free ""

Bucket 2 size=24--bucket 2 --24 bytes, that is, the size range of Bucket 2 is in 20-24 bytes.

Chunk 245b13e4 sz= Free ""

Chunk 23ace7c0 sz= Free ""

Chunk 239c5a28 sz= Free ""

Bucket 3 size=28

Chunk 24540e9c sz= Free ""

Chunk 2521209c sz= Free ""

Chunk 23483448 sz= Free ""


Bucket 198 size=1388

Bucket 199 size=1452----------Bucket 200 Bucket size is incremented by 4bytes

Chunk 2347d2ac sz= 1492 Free ""

Bucket size=1516----------Bucket 200 Bucket size is incremented by 64bytes

Chunk 24b28a94 sz= 1548 Free ""

Bucket 201 size=1580

Chunk 2433bb14 sz= 1620 Free ""

Chunk 2463a89c sz= 1620 Free ""

Chunk 24b829c4 sz= 1620 Free ""

Bucket size=1644

Chunk 23498518 sz= 1704 Free ""

Chunk 23de90d0 sz= 1696 Free ""


Bucket 236 size=3820

Bucket 237 size=3884

Bucket 238 size=3948

Bucket 239 size=4012--------------Bucket 200 to-bucket 239 The Bucket size of this section is incremented by 64bytes

Bucket size=4096-----------Bucket 239 After the Bucket size growth does not seem to be a big rule, in short, the increase of haha

Bucket 241 size=4100

Bucket 242 size=4108

Bucket 243 size=8204

Bucket 244 size=8460

Bucket 245 size=8464

Bucket 246 size=8468

Bucket 247 size=8472

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.