We recently encountered a quite intriguing memory leak problem coming from the
following Oracle Pro*C routine:
#include <sqlca.h>
#include <DBIntf.h>
long RollbackData (void *ConnectID)
{
long ErrorCode;
EXEC SQL ROLLBACK;
ErrorCode = sqlca.sqlcode;
return (ErrorCode);
}
Every time this routine was executed, we can observed several 32-byte nodes
were added to the ever growing doubly-linked list by examining the heap memory
map.
Some characteristic of our server application:
- the server is compiled with Pro*C/C++: Release 2.2.2.0.0 running on
HPUX 10.01 and accessing Oracle server 7.3.2.
- it uses ProC to connect and access the oracle database.
- after the connection, the server will run continuously for six days
before shut down on Sunday.
- the server is reading requests from the message queue thus no fork
was done.
- the server processes roughly 1500 transactions an hour.
- the server is leaking memory at a rate of 160K bytes per hour. So
after 6 days, the server's heap size will grow roughly 24M bytes
more.
- there are 18 identical server processes running at the same time, so
after 6 days, the total memory usage for those server is roughly
450M bytes.
- many requests to the server were error thus the above rollback
ProC routine were called frequently.
It seemed that when doing a rollback, Oracle/ProC was keeping a history or
journal of some sort. And this list seemed like a privately maintained global
doubly-linked list. A typical node of the list looked like the following:
0x0000beef 0x403422c8 0x40342318 0x8b01d217
0x00000000 0x16004353 0x0000beef 0x8b01d217
Where 0x0000beef looks like a magic word, 0x403422c8 is the left pointer, and
0x40342318 is the right pointer of a doubly-linked list. I was able to
confirmed that 0x0000beef word also appeared in libsql.a so this node
structure seemed to be defined in libsql.a.
Now the tough question, how do we tell Oracle/ProC not to maintained this ever
growing internal list? Thanks in advance for your help.
--
+-----------------------------------+
| Nick Chen 703-713-2584 |
| AT&T, Herndon, VA |
| ccserve!nchen_at_polaris.attmail.com |
| nickchen_at_attmail.com |
+-----------------------------------+
--
+-----------------------------------+