Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Pro*C problem: memory leak
This problem has made me wonder, and I am not at all certain about the solution. Part of it may be OS dependent, which OS are you using? Generally, I will leave a little bit of spare room in my VARCHARs. Probably make your first one 16, and your second 4, to keep them on nice DWORD boundries. You may be overwriting with your nulls, especially if you are on NT with UNICODE. (I know, it should automatically double the size of char, but....)
My first question would be does it still leak if you take out the loop? Does it show 100000 leaks, or just one?
My second question would be the EXEC SQL COMMIT WORK; We use EXEC SQL COMMIT; or EXEC SQL COMMIT WORK RELEASE; but I have never seen an EXEC SQL COMMIT WORK; I don't know what options your WORK adds to the commit.
My only suggestion would be that Oracle does not guarentee host variables beyond the next SQL statement. (i.e. anything returned from a FETCH is guarenteed until the next SQL statement. Since it is an update, I am not certain that tidFq and partition will be legitimate the second (or 900th) time around. Try setting the variables inside the loop.
Let me know if any of this works, although I am not very confident.
Terry Steyaert
steyaert_at_my-deja.com
P.S. The last time you posted this, I marked it to check if you received any answers, but haven't gotten back to looking backwards. I was going to answer....
In article <38A8277E.A3B42328_at_eft.be>,
Thierry Toussaint <ttoussaint_at_eft.be> wrote:
>
> Hello everybody!
>
> I have a memory leak problem when proceeding to UPDATE statements.
> The problem occurs when I use host variables, but does not occur when
I
> use hardcoded values.
>
> I use Pro*C version 8.0.4.0.0 and Borland C++5.01
>
> In the example below the memory leak problem does not occur when
> replacing host variables with fixed values
>
> EXEC SQL BEGIN DECLARE SECTION;
> VARCHAR tidFQ[9];
> VARCHAR partition[2];
> EXEC SQL END DECLARE SECTION;
>
> strcpy(tidFQ.arr,"02020000");
> tidFQ.len=strlen(tidFQ.arr);
> strcpy(partition.arr,"3");
> partition.len=strlen(partition.arr);
>
> for (long i = 0 ; i < 100000 ; i++)
> {
> EXEC SQL UPDATE FORMAT_QUEUE
> SET EVENTID = '007'
> WHERE TID = :tidFQ AND PARTITION = :partition;
>
> if (sqlca.sqlcode<0)
> {
> cout << "A problem occured";
> }
>
> EXEC SQL COMMIT WORK;
>
> cout << i << endl;
> }
>
> Any hint would help.
>
> Thanks!
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Feb 15 2000 - 00:00:00 CST
![]() |
![]() |