Forum Stats

  • 3,838,749 Users
  • 2,262,397 Discussions
  • 7,900,750 Comments

Discussions

Memory Leak when calling OCIStmtExecute

Juliano Franco
Juliano Franco Member Posts: 1 Green Ribbon
edited Mar 10, 2022 7:23PM in Oracle Call Interface (OCI)

Hi!

I have a STORED PROCEDURE which have some functions, updates, EXECUTE IMMEDIATE SQL_STMT and inserts inside. When a call the OCIStmtExecute (after OCIServerAttach, OCIAttrSet OCIStmtPrepare2, BindVar, etc), the process allocates memory and after finish it doesn't free this memory. I calling the OCIStmtExecute on a thread (pthread_create) and wait's till it finish.

I'm using Oracle Database 12c EE High Perf Release 12.1.0.2.0 - 64bit Production

and libclntshcore.so.12.1


Didin't see in documentation if have any special case to call procedures through OCIStmtExecute.


How I detected the leak:


pmap -x <pid> -> Get's how many memory my process is running before call the service

Execute 100 requests in my service

pmap -x <pid> -> Get's how many memory my process is running after call the service


The last pmap shows me more memory than before, so I attached the GDB to my process and ran line-by-line until reach the OCIStmtExecute line, so I execute the pmap before, execute the line in GDB (n shortcut) and get the pmap again. So the difference between pmaps is right there.


Can someone help me?


Thank's in advance

Tagged: