Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


MEMORY LEAK leak problems with PRO*C.

 
Logged in as: Guest
arrSession:exec spGetSession 2,4,2238
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP.NET >> MEMORY LEAK leak problems with PRO*C.
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 MEMORY LEAK leak problems with PRO*C. - 3/3/2005 6:40:16 PM   
  apbondoc

 

Posts: 1
Score: 0
Joined: 3/3/2005
From: Philippines
Status: offline
PROBLEM
Please Help me C++ guros with my problem in Pro*C.
I am having MEMORY LEAK leak problems with PRO*C. I am running the code below repeatedly and the vm of my application continuously increases.

SQL STATEMENT

/* select and lock table using FOR UPDATE */
EXEC SQL AT :sql_dbname DECLARE update_mid_cursor CURSOR
FOR SELECT ROWID
FROM PAYPAL_TRANS
//WHERE PHP_AMT = 0
WHERE TO_NUMBER(SUBSTR(MSINDN, 1, 5)) = :sql_range AND MODEM_ID = 0
ORDER BY ROWID ASC
FOR UPDATE;
if (sqlca.sqlcode != 0) {
DBError("ORACLE(GetMIDAssign[2])", sqlca, KILLAPP);
}
/* Open the cursor */
rows_to_select = 100;
EXEC SQL FOR :rows_to_select OPEN update_mid_cursor;
if (sqlca.sqlcode != 0) {
DBError("ORACLE(GetMIDAssign[3])", sqlca, KILLAPP);
}
EXEC SQL FOR :rows_to_select FETCH update_mid_cursor
INTO :sql_rowid;
if (sqlca.sqlcode != 0) {
DBError("ORACLE(GetMIDAssign[4])", sqlca, KILLAPP);
}
rows_to_select = sqlca.sqlerrd[2];
if (rows_to_select > 0) {
EXEC SQL AT :sql_dbname FOR :rows_to_select
UPDATE PAYPAL_TRANS
SET MODEM_ID = :sql_modem_id, TXT_MODEM_ID = :sql_txt_modem_id
WHERE ROWID = :sql_rowid;
if (sqlca.sqlcode != 0) {
DBError("ORACLE(GetMIDAssign[5])", sqlca, KILLAPP);
}
}
EXEC SQL CLOSE update_mid_cursor;
if (sqlca.sqlcode != 0) {
DBError("ORACLE(GetMIDAssign[6])", sqlca, KILLAPP);
}
EXEC SQL AT :sql_dbname COMMIT WORK;
if (sqlca.sqlcode != 0) {
DBError("ORACLE(GetMIDAssign[7])", sqlca, KILLAPP);
}

SOME OF THE THINGS I HAVE ACCOMPLISHED TRYING TO SOLVE THIS PROBLEM

1. determine if the problem is with the application code. Through isolation,
we were was able to conclude that the problem occurs with the pro*c code

2. checked the usage of cursors on the oracle server. I have experimented
with the RELEASE_CURSOR and HOLD_CURSOR pro*c precompiler options.
The application was able to properly close and release the cursor
according to our queries inside sqlplus.

SELECT * FROM V$SYSSTAT WHERE NAME LIKE '%cursor%';
STATISTIC# NAME
---------- ----------------------------------------------------------------
CLASS VALUE
---------- ----------
2 opened cursors cumulative
1 2825549

3 opened cursors current
1 22

205 session cursor cache hits
64 0

STATISTIC# NAME
---------- ----------------------------------------------------------------
CLASS VALUE
---------- ----------
206 session cursor cache count
64 0
207 cursor authentications
128 338
SQL>

3. used YAMD 0.32 to determine memory leaks. After recompiling and running
the application with the YAMD library, the following is a small snippet of what
was dumped on stdout:

/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0[0xb6da7a00]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sqlcxt+0x63)[0xb6da8173]
./gsm(vfprintf+0x8a7)[0x8049b0b]
./gsm(fwrite+0x166)[0x80495ca]
/lib/tls/libc.so.6(__libc_start_main+0xf8)[0xb6ab1748]
./gsm(_IO_getc+0x4d)[0x80494c1]
END TRACEBACK

WARNING: Memory leak
Address 0xb6a58fa0, size 96
Allocated by malloc at
BEGIN TRACEBACK
/lib/tls/libc.so.6(malloc+0x35)[0xb6b0bda5]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sltskminit+0x1f)[0xb7404ccf]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sltsini+0x75)[0xb74022f5]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(slxmxinit+0x1a)[0xb73f7a4a]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(lxzinit+0x32)[0xb73f6522]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpummpin+0x199)[0xb72d7419]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpupin+0x59)[0xb6e0d359]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(OCIInitialize+0x3c)[0xb6e61b8c]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0[0xb6dbb4d5]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sqlcfx+0x117)[0xb6dbbf57]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0[0xb6da7a00]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sqlcxt+0x63)[0xb6da8173]
./gsm(vfprintf+0x8a7)[0x8049b0b]
./gsm(fwrite+0x166)[0x80495ca]
/lib/tls/libc.so.6(__libc_start_main+0xf8)[0xb6ab1748]
./gsm(_IO_getc+0x4d)[0x80494c1]
END TRACEBACK

WARNING: Memory leak
Address 0xb6a5bfa0, size 96
Allocated by malloc at
BEGIN TRACEBACK
/lib/tls/libc.so.6(malloc+0x35)[0xb6b0bda5]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sltsini+0x4c)[0xb74022cc]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(slxmxinit+0x1a)[0xb73f7a4a]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(lxzinit+0x32)[0xb73f6522]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpummpin+0x199)[0xb72d7419]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpupin+0x59)[0xb6e0d359]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(OCIInitialize+0x3c)[0xb6e61b8c]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0[0xb6dbb4d5]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sqlcfx+0x117)[0xb6dbbf57]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0[0xb6da7a00]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sqlcxt+0x63)[0xb6da8173]
./gsm(vfprintf+0x8a7)[0x8049b0b]
./gsm(fwrite+0x166)[0x80495ca]
/lib/tls/libc.so.6(__libc_start_main+0xf8)[0xb6ab1748]
./gsm(_IO_getc+0x4d)[0x80494c1]
END TRACEBACK

WARNING: Memory leak
Address 0xb6a6ab56, size 148650
Allocated by malloc at
BEGIN TRACEBACK
/lib/tls/libc.so.6(malloc+0x35)[0xb6b0bda5]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sktsfMalloc+0x1f)[0xb73971bf]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpummealloc+0x55)[0xb72d8335]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpuiniSG+0x47)[0xb6e0d607]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpummpin+0x10c)[0xb72d738c]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpupin+0x59)[0xb6e0d359]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(OCIInitialize+0x3c)[0xb6e61b8c]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0[0xb6dbb4d5]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sqlcfx+0x117)[0xb6dbbf57]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0[0xb6da7a00]
/u01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(sqlcxt+0x63)[0xb6da8173]
./gsm(vfprintf+0x8a7)[0x8049b0b]
./gsm(fwrite+0x166)[0x80495ca]
/lib/tls/libc.so.6(__libc_start_main+0xf8)[0xb6ab1748]
./gsm(_IO_getc+0x4d)[0x80494c1]
END TRACEBACK

WARNING: Total memory leaks:
603 unfreed allocations totaling 751211 bytes

*** Finished at Fri Mar 4 12:01:04 2005
Allocated a grand total of 1123035 bytes
1725 allocations
Average of 651 bytes per allocation
Max bytes allocated at one time: 900999
21512 K alloced internally / 12384 K mapped now / 12040 K max
Virtual program size is 34192 K
End.




Clearly, we have a memory leak problem.


ENVIROMENT SETTINGS

(1) Makefile snippet

PROCPPFLAGS=CODE=CPP CPP_SUFFIX=c THREADS=YES HOLD_CURSOR=YES MAXOPENCURSORS=10 $(CPLUS_SYS_INCLUDE) select_err=no

ORACLE_INCLUDE=-O3 -trigraphs -fPIC -DPRECOMP -D_REENTRANT -I/u01/app/oracle/product/9.2.0/precomp/hdrs - I/u01/app/oracle/product/9.2.0/precomp/public -I/u01/app/oracle/product/9.2.0/precomp/include - I/u01/app/oracle/product/9.2.0/oracore/include -I/u01/app/oracle/product/9.2.0/oracore/public - I/u01/app/oracle/product/9.2.0/oracore/port/include -I/u01/app/oracle/product/9.2.0/xdk/include - I/u01/app/oracle/product/9.2.0/xdk/public -I/u01/app/oracle/product/9.2.0/nlsrtl/include - I/u01/app/oracle/product/9.2.0/slax/include -I. -I../c++_lib -I/usr/include/c++/3.2.3/backward

ora_db.o: ora_db.pc
$(PROC) $(PROCPPFLAGS) SYS_INCLUDE=(/usr/include,/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include,../c++_lib) iname=ora_db.pc
${MAKE} ${ORACLE_INCLUDE} -D_REENTRANT -c ora_db.c

(2) Red Hat Linux 2.4.21-4.ELsmp
(3) Oracle Version 9.2.0.1
(4) Pro*C/C++: Release 9.2.0.1.0 - Production on Fri Mar 4 14:01:22 2005
(5) YAMD 0.32
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP.NET >> MEMORY LEAK leak problems with PRO*C. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts