Unexpected PGA Increase When Same Named CURSOR Opened Twice

(Doc ID 2380219.1)

Last updated on MARCH 30, 2018

Applies to:

PL/SQL - Version 11.2.0.4 and later
Information in this document applies to any platform.

Symptoms

Increase in PGA memory when PL/SQL procedure with same named cursor being opened twice i.e using for loop and open-fetch-close
and that procedure when called multiple number of times in loop.

Every-time when procedure is being called in loop, a growth in PGA memory happens without reusing or clean-up that memory.

The below sample snippet which demonstrates the behavior (Educational purpose only).

 

Note: The output given above is for understanding purpose, different results may appear based on different code and memory settings.

The leak can be seen in heap dumps at each iteration of the procedure.
The following subheaps may present and will grow in subsequent dumps.

freeable  "koh-kghu sessi"
freeable  "session heap"
freeable  "RLP space in ar"

Memory leak with the comment "RLP space in ar" is an indication of facing the issue.

Changes

None. Issue can be reproduced in all versions.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms