A notable distinction between the Shared Pool and the
buffer cache (which is also shared between sessions) is that the shared pool primarily caches metadata while the buffer cache stores data.
Examining the contents of the Shared Pool
The following query shows the summed up allocations of memory for various components in the Shared Pool:
select
name,
to_char(bytes/1024/1024, '999,999,990.00') mb
from
v$sgastat
where
pool = 'shared pool'
order by
bytes desc;
While the previous query shows summations, more detailed information about individual objects in the Shared Pool can be queried from
Allocating memory / Heap manager
The heap manager allocates and releases memory for/from the Shared Pool and keeps track of allocations in the Shared Pool.
When the heap manager is requested to allocate a certain amount of memory, it tries to locate a chunk of contiguous memory to satisfy this request.
If such a contiguous space cannot be found, a process begins to free batches of heaps from the shared pool until the chunk can be allocated.