Hi,
I'm the maintener of some Delphi 7 / 10 Windows services using our DOA components.
They poll the DB with many similar queries, so our dba asks me if is possible to cache the queries these services do.
Ok. I set to true the StatementCache property of the TOracleSession component.
The query appears to be effectively cached to Oracle but since then, I noticed a constant memory leak (proportional to the queries executed).
I have attached to this post a simple test app to reproduce the issue.
This app extracts the first rows (1..10) of a table. The query is repeated many times, so the memory leak is very evident.
Code
// Create a simple parametric query with 10 variants - StatementCacheSize of the session is 20
 // QUERY THE FIRST COLUMNS OF THE SPECIFIED TABLE OF THE DB
 MyQuery          := TOracleQuery.Create(nil);
 myQuery.Session  := OracleSession1;
 MyQuery.SQL.Text := 'SELECT * FROM '+myTableEdit.Text +' WHERE ROWNUM < ( :NUM + '+ IntToStr(random(10))+')' ;

 // Execute the query
 myQuery.DeclareAndSet('NUM',otString,IntToStr(random(100)));
 myQuery.Execute;
 myQuery.RowCount;
 myQuery.Close;
 FreeAndNIL(myQuery);
I have also played with many configurations but without success.
The only workaround seems to close and open periodically the session (logOff/logOn).
I also tried to download the latest releases of the DOA (trial version) but this seems not to fix my problem because the leak will persist.
We surely upgraded the components with the newer available but if the problem persists is obviously useless.
There are someone that faced and solved the same issues ?

Thanks,
Giovanni

Attached Files
CacheTest.zip (4.62 KB, 1 downloads)
SHA1: 358a7e3badb00e990d5e883174a1c94fe6649325