Memory leak in ESQL/C programs
Posted in 1999
Hello, OK, but how can you detect memory on HP-UX (without tracing malloc and free). I know there exists memorymap or mallinfo but it's a little bit confusing .... Best regards PGI ______________________________ Reply Separator _________________________________ Subject: WG: ESQL/C : Cursors statistics ? Author: Non-HP-rgrzyb (rgrzyb@thiestextilmaschinen.de) at HP-Europe,shargw4 Date: 07/07/99 11:36 Is a CLOSE CURSOR satisfied to free all memory or must there a explicit FREE CUR SOR ? i use the following sequence and it seems, there was a memory leak EXEC SQL ALLOCATE DESCRIPTOR :pCmdId WITH MAX MAXCOLUMNS; EXEC SQL PREPARE :pCmdId FROM :pSQLCmd; EXEC SQL DESCRIBE :pCmdId USING SQL DESCRIPTOR :pCmdId; if (SQLC < 0) { /* ERROR */ return(FALSE); } /* Speicherplatz fuer DESCRIPTOR ist allokiert worden -> merken um spaeter fre izugeben */ pTclDBStmt->bAllocDesc = TRUE; if (SQLC == 0) /* Select with result-Set */ { EXEC SQL DECLARE :pCmdId CURSOR FOR :pCmdId; EXEC SQL OPEN :pCmdId; bOpenCursor=TRUE; } else { EXEC SQL EXECUTE :pCmdId; bOpenCursor=FALSE; } if (bOpemCursor) { EXEC SQL CLOSE :pCmdId; } EXEC SQL FREE :pCmdId; EXEC SQL DEALLOCATE DESCRIPTOR :pCmdId; Whats?s wrong ? Thanks Roland -----Ursprungliche Nachricht----- Von: Art S. Kagel [SMTP:kagel@bloomberg.net] Gesendet am: Dienstag, 6. Juli 1999 22:11 An: informix-list@iiug.org Betreff: Re: ESQL/C : Cursors statistics ? Stephane Revil-Baudard wrote: > > Hi, > > I've several questions about CURSORs in ESQL/C (informix 7.24) > > 1)- I'd like to know how many CURSORs can I > declare/open at the same time ? The release notes say the number of open cursors per user is port specific. I have programs with close to 1000 running up to 20 copies of each with no problems. > 2)- Same question with CURSORs declared WITH HOLD Adding the WITH HOLD option should make no difference. > 3)- Is there a command that would give the max of > this figure ? > 4)- Is there a command that would give the number > of opened CURSORs ? No way to determine except to keep track yourself. > In fact, I declare and open a CURSOR WITH HOLD, then, > if there is an error in my program (timeout on access > to a distant database) > 5)- Do the CURSOR stay open ? Cursor's stay open until closed either by an explicit CLOSE or FREE or because of an emplied CLOSE when COMMITTING or ROLLING BACK another cursor if not WITH HOLD. > 6)- In my program, there is no FREE CURSOR, do you think > it could be a problem ? Just bad form. Like malloc() without free(). > thanks for your help You're welcome. Art S. Kagel