X-Original-To: pgsql-odbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C89059FA5E1 for ; Wed, 14 Jun 2006 08:50:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 53535-01 for ; Wed, 14 Jun 2006 08:49:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from new-mail.nec.com.cn (new-mail.nec.com.cn [211.100.22.21]) by postgresql.org (Postfix) with ESMTP id F25989F9CAA for ; Wed, 14 Jun 2006 08:49:47 -0300 (ADT) Received: from internal-mail.nec.com.cn ([172.28.88.254]) by new-mail.nec.com.cn with ESMTP id k5EBfOXo078946 for ; Wed, 14 Jun 2006 19:41:24 +0800 (CST) (envelope-from zhaox@necas.nec.com.cn) Received: from mailsv.necas.nec.com.cn (localhost.localdomain [127.0.0.1]) by internal-mail.nec.com.cn (Postfix) with ESMTP id C03FC178005 for ; Wed, 14 Jun 2006 19:56:56 +0800 (CST) Received: from [172.28.9.250] (jianglong.necas.nec.com.cn [172.28.9.250]) by mailsv.necas.nec.com.cn (8.11.6/8.11.6) with ESMTP id k5EBfO808455 for ; Wed, 14 Jun 2006 19:41:24 +0800 Message-ID: <448FF5A6.1060202@necas.nec.com.cn> Date: Wed, 14 Jun 2006 19:40:22 +0800 From: zhaoxin User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: Re: Memory Leak ? References: <4487E76B.4000805@necas.nec.com.cn> <20060609112005.GD8153@soptik.pzkagis.cz> In-Reply-To: <20060609112005.GD8153@soptik.pzkagis.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-MAIL: new-mail.nec.com.cn k5EBfOXo078946 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/98 X-Sequence-Number: 7846 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 *******************************************