"LTDEV" <nos@pam.pl> wrote in message
news:%23FgMhtFQHHA.856@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> Hope i have the newsgroup im going out of my mind.
>
> I made a little ODBC client that fills in some data into a table, and it
> was working fine, then i wanted to stresstest it, and then it showed the
> leak.
>
> I have browsed allover, and i found this KB on MS, then i took my own
> little program and replaced it by the one stated below in the article, and
> the result is the same, i get the leak:
>
> ------------------------------------------------------------------------------------------------------------------------------
>
> Problem described by MS here:
>
>
http://207.46.248.248/kb/232351
>
> Source listing here:
>
> #include <windows.h>
> #include <stdio.h>
> #include <sql.h>
> #include <sqlext.h>
> #include <assert.h>
>
> #define CK_RT(x) if( x != SQL_SUCCESS && x != SQL_SUCCESS_WITH_INFO)
> assert(0)
>
> void main(){
> HENV henv;
> HDBC hdbc;
> RETCODE rc = SQL_SUCCESS;
> char *dsnStr="DSN=OracleServer;UID=scott;pwd=tiger;";
> short rtnLen = 0;
> UCHAR rtnDSN[999] = "";
> int i,x;
>
>
> for (i=0; i < 100; i++)
> {
> rc = SQLAllocEnv(&henv);
> CK_RT(rc);
> rc = SQLAllocConnect(henv, &hdbc);
> CK_RT(rc);
> rc = SQLDriverConnect(hdbc,
> NULL,
> (unsigned char *)dsnStr,
> strlen(dsnStr),
> rtnDSN,
> 255,
> &rtnLen,
> SQL_DRIVER_NOPROMPT);
>
> CK_RT(rc);
> SQLDisconnect(hdbc);
> SQLFreeConnect(hdbc);
> SQLFreeEnv(henv);
> }
> }
> --------------------------------------------------------------------------------------------------------------------
>
> The above applies according to the article for Oracle and for NT40, now
> what i have here is a very simple setup with a Firebird opensource
> database, and the official ODBC driver for this, and ive tested this on XP
> SP2, and on a 2003 server, with the same annoying results.
>
> Can anybody help me, is the problem im having a real bug (as stated in the
> KB) or am i doing something wrong ?
>
> The reason for this stresstest where im opening a connection and kills it
> again, is that that would be how the application would work in realtime,
> so its pretty important that its possible to create, write, destroy
> without leaks.
>
> If im in a wrong newsgroup, then i hope some of you could guide me the
> right way - its such a simple program, and its my first ODBC interfacing,
> then it hurts alot to hit a memory-leak in first go.
>
> REALLY hope you can help me...thanks.
>