pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: zhaoxin <zhaox@necas.nec.com.cn>
To: pgsql-odbc@postgresql.org
Subject: Re: Memory Leak ?
Date: Wed, 14 Jun 2006 19:40:22 +0800
Message-ID: <448FF5A6.1060202@necas.nec.com.cn> (raw)
In-Reply-To: <20060609112005.GD8153@soptik.pzkagis.cz>
References: <4487E76B.4000805@necas.nec.com.cn>
	<20060609112005.GD8153@soptik.pzkagis.cz>

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
*******************************************



view thread (21+ messages)  latest in thread

Message-ID: <448FF5A6.1060202@necas.nec.com.cn>
Permalink:  ../448FF5A6.1060202@necas.nec.com.cn/
Also on:    postgresql.org/message-id/448FF5A6.1060202@necas.nec.com.cn

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: zhaox@necas.nec.com.cn
  Subject: Re: Memory Leak ?
  In-Reply-To: <448FF5A6.1060202@necas.nec.com.cn>
  References: <4487E76B.4000805@necas.nec.com.cn> <20060609112005.GD8153@soptik.pzkagis.cz> <448FF5A6.1060202@necas.nec.com.cn>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox