Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Memory Leak Oracle 8.0

Re: Memory Leak Oracle 8.0

From: Andrew Protasov <oracle_at_protasov.kiev.ua>
Date: Mon, 14 Dec 98 14:11:59 +0200
Message-ID: <ABF2GTsK42@protasov.kiev.ua>

Hi,

I think that you can find ProC from Oracle 7.3 and use it with Oracle 8 client software.

Andrew Protasov

> Hi,
> Thanks for the efforts taken. But Pro C/C++ doesn't generate calls to OCI.
> How can i fix the problem.
> Thanks a lot for the help
> bindu
>
> In article <ABkfQSsK42_at_protasov.kiev.ua>,
> oracle_at_protasov.kiev.ua wrote:
> >
> > Hi,
> >
> > I just finished my tests. So the result is - there is NO
> > memory leak in OCI7 implementation of Oracle 8.0.3 client
> > for NT and there IS a memory leak in OCI8 implementation of the
> > same client. This is the reason why Server Manager works
> > correctly (OCI7) but SQL Plus has memory leak (OCI8).
> >
> > This OCI7 test source:
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <string.h>
> > #include <oratypes.h>
> > #include <ocidfn.h>
> > #include <ociapr.h>
> >
> > struct cda_def lda;
> > unsigned char hda[512];
> >
> > int checkerr(struct cda_def *lda,int i);
> > int main(int argc,char **argv)
> > {
> > int i=0,j,k;
> > if(argc!=5)
> > printf("testcon7 <username> <password> <sqlnetalias> <iterations>\n");
> > else
> > {
> > k=atoi(argv[4]);
> > for(j=1;j<=k;j++)
> > {
> > memset(&lda,0,sizeof(lda));
> > memset(&hda,0,sizeof(hda));
> >
> if(i=checkerr(&lda,olog(&lda,hda,argv[1],-1,argv[2],-1,argv[3],-1,OCI_LM_DEF)))
> goto err1;
> > printf("Connect iteration %d\n",j);
> > if(i=checkerr(&lda,ologof(&lda))) goto err1;
> > }
> > }
> > err1: return i;
> > }
> > int checkerr(struct cda_def *lda,int i)
> > {
> > char errbuf[1024];
> > if(i)
> > {
> > oerhms(lda,(short)i,errbuf,sizeof(errbuf));
> > printf("Error %s",errbuf);
> > }
> > return i;
> > }
> >
> > This is OCI8 test source:
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <string.h>
> > #include <oci.h>
> >
> > #define anderror(i,j) ((i)=(i)?(i):(j))
> >
> > static OCIEnv *envhp;
> > static OCIError *errhp;
> > static OCIServer *srvhp;
> > static OCISvcCtx *svchp;
> > static OCISession *authp;
> >
> > int checkerr(OCIError *errhp,int i);
> >
> > int main(int argc,char **argv)
> > {
> > int i=0,e,j,k;
> > if(argc!=5)
> > printf("testcon7 <username> <password> <sqlnetalias> <iterations>\n");
> > else
> > {
> > if(i=OCIInitialize(OCI_DEFAULT,NULL,NULL,NULL,NULL)) goto err99;
> > if(i=OCIEnvInit(&envhp,OCI_DEFAULT,0,NULL)) goto err99;
> > if(i=OCIHandleAlloc(envhp,&errhp,OCI_HTYPE_ERROR,0,NULL)) goto err98;
> > if(i=OCIHandleAlloc(envhp,&srvhp,OCI_HTYPE_SERVER,0,NULL)) goto err97;
> > if(i=OCIHandleAlloc(envhp,&svchp,OCI_HTYPE_SVCCTX,0,NULL)) goto err96;
> > k=atoi(argv[4]);
> > for(j=1;j<=k;j++)
> > {
> > authp=NULL;
> >
> if(i=checkerr(errhp,OCIServerAttach(srvhp,errhp,argv[3],strlen(argv[3]),OCI_DEFA
> ULT))) goto err95;
> >
> if(i=checkerr(errhp,OCIAttrSet(svchp,OCI_HTYPE_SVCCTX,srvhp,0,OCI_ATTR_SERVER,er
> rhp))) goto err94;
> > if(i=OCIHandleAlloc(envhp,&authp,OCI_HTYPE_SESSION,0,NULL)) goto err94;
> >
> if(i=checkerr(errhp,OCIAttrSet(authp,OCI_HTYPE_SESSION,argv[1],strlen(argv[1]),O
> CI_ATTR_USERNAME,errhp))) goto err93;
> >
> if(i=checkerr(errhp,OCIAttrSet(authp,OCI_HTYPE_SESSION,argv[2],strlen(argv[2]),O
> CI_ATTR_PASSWORD,errhp))) goto err93;
> >
> if(i=checkerr(errhp,OCISessionBegin(svchp,errhp,authp,OCI_CRED_RDBMS,OCI_DEFAULT
> ))) goto err93;
> >
> if(i=checkerr(errhp,OCIAttrSet(svchp,OCI_HTYPE_SVCCTX,authp,0,OCI_ATTR_SESSION,e
> rrhp))) goto err92;
> > printf("Connect iteration %d\n",j);
> > err92: e=checkerr(errhp,OCISessionEnd(svchp,errhp,authp,OCI_DEFAULT));
> anderror(i,e);
> > err93: e=OCIHandleFree(authp,OCI_HTYPE_SESSION); anderror(i,e);
> > err94: e=checkerr(errhp,OCIServerDetach(srvhp,errhp,OCI_DEFAULT));
> anderror(i,e);
> > if(i) goto err95;
> > }
> > err95: e=OCIHandleFree(svchp,OCI_HTYPE_SVCCTX); anderror(i,e);
> > err96: e=OCIHandleFree(srvhp,OCI_HTYPE_SERVER); anderror(i,e);
> > err97: e=OCIHandleFree(errhp,OCI_HTYPE_ERROR); anderror(i,e);
> > err98: e=OCIHandleFree(envhp,OCI_HTYPE_ENV); anderror(i,e);
> > }
> > err99: return i;
> > }
> > int checkerr(OCIError *errhp,int i)
> > {
> > char errbuf[1024];
> > if(i&&!OCIErrorGet(errhp,1,NULL,&i,errbuf,sizeof(errbuf),OCI_HTYPE_ERROR))
> > printf("Error %s",errbuf);
> > return i;
> > }
> >
> > You may try this with newer Oracle client software.
> >
> > Andrew Protasov
> >
> > > Hello!
> > >
> > > Well, I tried this too, now with Server Manager, which I somehow had
> > > not tried before..
> > >
> > > My current Oracle version is 8.0.4 in NT 4 SP3.
> > >
> > > Yes, no leak in svrmgr80, none whatsoever. I even extended that test
> > > script to look like
> > >
> > > connect abba/babba_at_myserv
> > > select 1 from dual;
> > > disconnect
> > > ...
> > >
> > > This is because SQL*Plus does some invisible SQL and opens cursors
> > > 'behind curtains' when connected, and I though that Server Manager
> > > maybe does not. No joy, svrmgr30 still stable.
> > >
> > > I think they all should use the same OCI. Programs are linked to
> > > OCIW32.DLL, which in turn calls to whatever runtime is installed (so
> > > there's no need to relink apps when the runtime environment changes).
> > >
> > > Maybe it is so, that SQL*Plus code has a leak in it, it's not in OCI
> > > then.
> > >
> > > BUT, I remember that when I discovered the leak in my apps (it's maybe
> > > 1 year ago, I tried a simple program just connecting/disconnecting
> > > (just like that SQL-script, only with OCI calls orlon/ologof), the
> > > leak was there. Made that SQL*Plus test then, to prove the leak is not
> > > in my code..
> > >
> > > Have to test that again, maybe it's gone with 8.0.4!
> > >
> > > >
> > > >Hi,
> > > >
> > > >I tried your test with Oracle Client and Server 8.0.3. Yes,
> > > >there is a memory leak in plus80.exe and plus80w.exe
> > > >(Windowed version). But I did not find any memory leak
> > > >with your test in svrmgr30.exe (Server Manager). Maybe
> > > >it depends on OCI version? I do not know what OCI 7 or
> > > >OCI 8 each of them uses.
> > > >
> > > >And there is no any memory leak in Oracle 8.0.3 Server
> > > >for NT during this test.
> > > >
> > >
> > >
> > >
> >
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
>
Received on Mon Dec 14 1998 - 06:11:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US