Re: Memory Leak ? - Mailing list pgsql-odbc
From | zhaoxin |
---|---|
Subject | Re: Memory Leak ? |
Date | |
Msg-id | 448FF5A6.1060202@necas.nec.com.cn Whole thread Raw |
In response to | Re: Memory Leak ? (Ludek Finstrle <luf@pzkagis.cz>) |
Responses |
Re: Memory Leak ?
|
List | pgsql-odbc |
to:Luf Thanks for you response. my test program is below ,and I expect for you help . Table structure: ************************************* CREATE TABLE TestLeak ( c1 int4, c2 text, c3 int4 ) ************************************* my program is like this: ************************************* void testInsert(){ char *sqlInsert="insert into TestLeak values(?,?)"; char szTmp[STR_LEN];//STR_LEN = 132 SQLINTEGER sOrderID=0 ,cbValue = SQL_NTS; SQLINTEGER cbOrderID = 0 ; int i; //initialize memset(szTmp,0,STR_LEN); memset(szTmp,'a',STR_LEN-1);//insert 'a' //INSERT for(i = 0 ; i < count ; i++) { retcode = SQLPrepare(hstmt,(SQLCHAR*)sqlInsert,SQL_NTS); SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG,SQL_INTEGER, 0, 0, &sOrderID, 0, &cbOrderID); SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR,STR_LEN, 0, &szTmp, 0, &cbValue); SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &sOrderID, 0, &cbOrderID); sOrderID = i; retcode = SQLExecute(hstmt); if( RC_NOTSUCCESSFUL(retcode)) { exit_nicely(); } } retcode = SQLFreeStmt(hstmt,SQL_RESET_PARAMS); SQLEndTran(SQL_HANDLE_DBC,(SQLHDBC)hdbc, SQL_COMMIT); } ****************************************************************** thanks, zhao Ludek Finstrle wrote: >> SQLAllocHandle (SQL_HANDLE_ENV, NULL, &henv); >> SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); >> SQLConnect (hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPasswd, SQL_NTS); >> SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt); >> while( i < 10){ >> SQLPrepare(hstmt,(SQLCHAR*)szSql, SQL_NTS); >> SQLBindParameter(......); >> ...... > > > Please could you send us the exact szSql and their BindParameters > so we don't have to make steps into dark? BTW table structure and > some sample data could help too. > It speeds up finding the problem. > > >> SQLExecute(hstmt); >> SQLFreeStmt(hstmt,SQL_RESET_PARAMS); >> } >> SQLEndTran(SQL_HANDLE_DBC,(SQLHDBC)hdbc, SQL_COMMIT); >> SQLFreeStmt(hstmt, SQL_CLOSE); >> SQLFreeHandle(SQL_HANDLE_STMT, hstmt); >> SQLDisconnect(hdbc); >> SQLFreeHandle(SQL_HANDLE_DBC, hdbc); > > > Regards, > > Luf > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > -- 以上、よろしくお願いいたします。 ******************************************* NEC-CAS 基盤ソフトウェア開発本部 第二開発部 趙 新 E-mail:zhaox@necas.nec.com.cn Telel :8-0086-22-425 外 線:(010)8233-4433-425 *******************************************
pgsql-odbc by date: