vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I have a C++ application for testing memory leak that connects to PostgreSQL8.1.3 Database using psqlODBC 08.01.02.00 unicode driver. I have found some memory leak with the windows performance tool. I have tried to upgrade the psqlODBC to 08.02.0002 ,but the leak still exists. The piece of my Code is like this: 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(......); ...... 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); my Env: VC.net, windows2003 server, PostgreSQL8.1.3 some of you have faced similar issue for memory leak? or I have made some misstake in Using the Odbc function? If you could help me, that would be great! thanks, zhao ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| |||
| > 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 |
| |||
| 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 外 線 ******************************************* ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
| |||
| zhaoxin wrote: > to:Luf > > Thanks for you response. > my test program is below ,and I expect for you help . Could you try the dll at http://www.geocities.jp/inocchichich...dbc/index.html ? Recently I found a memory leak in some combination of connection options. regards, Hiroshi Inoue ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend |
| |||
| TO: Hiroshi Inoue > Could you try the dll at > http://www.geocities.jp/inocchichich...dbc/index.html ? > Recently I found a memory leak in some combination of connection > options. I have tested the driver downloaded from this link . but memory leak seems still exist . regards, zhao ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| |||
| zhaoxin wrote: > TO: Hiroshi Inoue > >> Could you try the dll at >> http://www.geocities.jp/inocchichich...dbc/index.html ? >> Recently I found a memory leak in some combination of connection >> options. > I have tested the driver downloaded from this link . > but memory leak seems still exist . Could you tell me your connection string ? regards, Hiroshi Inoue ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| TO:Hiroshi Inoue >>> Could you try the dll at >>> http://www.geocities.jp/inocchichich...dbc/index.html ? >>> Recently I found a memory leak in some combination of connection >>> options. >> >> I have tested the driver downloaded from this link . >> but memory leak seems still exist . > > > Could you tell me your connection string ? My connection string is like this (with ODBC default settings): SQLAllocHandle (SQL_HANDLE_ENV, NULL, &henv); SQLSetEnvAttr(henv,SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3,SQL_IS_INTEGER); SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); SQLSetConnectOption(hdbc,SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); SQLConnect(hdbc,(SQLCHAR*)szDSN, (SQLSMALLINT)strlen(szDSN), (SQLCHAR*)szUID, (SQLSMALLINT)strlen(szUID), (SQLCHAR*)szAuthStr, (SQLSMALLINT)strlen(szAuthStr)); SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt); ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| |||
| zhaoxin wrote: > TO:Hiroshi Inoue > > >>>> Could you try the dll at >>>> http://www.geocities.jp/inocchichich...dbc/index.html ? >>>> Recently I found a memory leak in some combination of connection >>>> options. >>> >>> I have tested the driver downloaded from this link . >>> but memory leak seems still exist . >> >> >> Could you tell me your connection string ? > > My connection string is like this (with ODBC default settings): Could you tell me the option settings concretely ? regards, Hiroshi Inoue ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| |||
| > >>>Could you try the dll at > >>> http://www.geocities.jp/inocchichich...dbc/index.html ? > >>>Recently I found a memory leak in some combination of connection > >>>options. > >> > >>I have tested the driver downloaded from this link . > >>but memory leak seems still exist . > > > > > >Could you tell me your connection string ? > > My connection string is like this (with ODBC default settings): > > SQLConnect(hdbc,(SQLCHAR*)szDSN, (SQLSMALLINT)strlen(szDSN), > (SQLCHAR*)szUID, (SQLSMALLINT)strlen(szUID), > (SQLCHAR*)szAuthStr, (SQLSMALLINT)strlen(szAuthStr)); Hiroshi needs to know the value for szDSN. Regards, Luf ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| ||||
| >>>Could you tell me your connection string ? >> >>My connection string is like this (with ODBC default settings): >> >> SQLConnect(hdbc,(SQLCHAR*)szDSN, (SQLSMALLINT)strlen(szDSN), >> (SQLCHAR*)szUID, (SQLSMALLINT)strlen(szUID), >> (SQLCHAR*)szAuthStr, (SQLSMALLINT)strlen(szAuthStr)); > > > Hiroshi needs to know the value for szDSN. > ok,I see . my connection string is below: *************************** char szDSN[20]; char szUID[20]; char szAuthStr[20]; .... sprintf(szDSN,"postgre_8.02\0"); sprintf(szUID,"test\0"); sprintf(szAuthStr,"test\0"); .... *************************** is there some problem here ? ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |