Memory leaks using Informix SE 5.0
Posted in 1995
Topics: High Availability & Replication, Connectivity: ESQL/C, 4GL & Embedded SQL
We encounter the following problem using Informix SE on several servers (Sun SunOS 4.1.3, HP HP/UX 9.04) on a program written in ESQL/C : We declare, open and close a cursor on a select statment (any select shows the problem). If we call the testinf() function, we got a memory leak of 64 bytes. Il we call the testinf() function 5 times (the ESQL/C program supply with this message executes the testinf() function 5 times) we obtains several memory leaks : 1024 bytes (4 times) = 4096 total bytes. _sqrealloc (iqutil.o) _sqg_desc (iqreturn.o) _sqr_desc (iqreturn.o) _iqprepare (iqdynam.o) _iqnprep (iqdynam.o) testinf (testinf.o) 64 bytes (5 times) = 320 total bytes. _sqrealloc (iqutil.o) _iqnormdesc (iqdynam.o) _iqdescribe (iqdynam.o) testinf (testinf.o) main (testinf.o) start (usr_lib_crt0.o) 11 bytes (4 times) = 44 total bytes. _sqrealloc (iqutil.o) _sqg_desc (iqreturn.o) _sqr_desc (iqreturn.o) _iqprepare (iqdynam.o) _iqnprep (iqdynam.o) testinf (testinf.o) 10 bytes (4 times) = 40 total bytes. _sqrealloc (iqutil.o) _sqg_desc (iqreturn.o) _sqr_desc (iqreturn.o) _iqprepare (iqdynam.o) _iqnprep (iqdynam.o) testinf (testinf.o) It seems that the Informix functions that replace the different EXEC SQL statment allocate the memory blocks they needs each times they are called (that could be the reason why there 4 memory leaks for each block size). The 64 bytes block seems to be the _SQCURSOR structure describe in sqlhdr.h and returns by the _iqnprep() Informix internal function. The others memory leaks could be some of the pointers contain in this structure. How can we do to avoid this problem. We don't know how to free the memory blocks allocated by the underlying ESQL/C functions. Thanks in advance. Roger FLATTIN CORNUT Informatique (This file must be converted with BinHex 4.0) :#R4PFh4TEQBZC@-!9%9B9(4dH(3!!!!!"48!!!&-NQSMD@jME(9NC5!mFh4ND@m ZD$i0$89B48-J8e&-)%P13da94%8JFh&XBf%l$89B48-J8e&-)%P13da94%8JFh &XC'%l$3d[+JdU+L")B@jNE'8J8e&-)'9bFQpbF`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!-J##05J2EJ!!!"`!-J!!Fh4jE!!!! !S!J2rr!!!!!!##1!a!2!: +------------------------------------+--------------------------+ | Roger Flattin | Phone : (33) 77 93 57 46 | | Cornut Informatique | Fax : (33) 77 92 51 39 | | 24, rue de la Telematique - BP 702 | AppleLink : CORNUT.INF | | 42950 St Etienne cedex 9 FRANCE | Compuserve: 100303,1061 | | frederic_bouquet@ascus.com | | +------------------------------------+--------------------------+