2

I have a Delphi 11 application that does basic Extract / Transform / Load. I am using UniDAC from DevArt for the database connections. I am running on Windows server... I am reading from an Oracle DB and writing to a MSSQL database.

I have never encountered this before - but it is the first time we are doing over 7 million records from an Oracle DB.

Basically - I have two UniConnections (Oracle and MSSQL) - and a few UniQueries to handle the read from the Oracle and the Insert into MSSQL.

The problem is that the program just keeps consuming more and more memory - until I get to about 3.5 million records - at which point I get out of memory errors. The machine has 16 GB of memory I have tried all sorts of things - closing and opening the UniQueries every 500 records, I have tried also closing and opening the UniConnection - and nothing works. I figured if I was closing the database connection - then it should free up the memory for those objects - but it does not look like it is doing that. I even tried freeing the UniQueries and recreating and reopening them - still the same problem. It is not until I CLOSE the application that the memory is finally freed.
I have run Deleaker and it is not reporting any memory leaks... I am at a loss as to what is causing this! It is a fairly straight forward ETL program - no memo fields, just strings, numbers and date fields. No big processing just combining some strings and then writing it to the MSSQL table.

For the Delphi folks out there - if you close a TQuery should not the memory that was used by it be reclaimed? What if you free the object?

Any thoughts would be appreciated as where else I can look? I am getting to the point where I will have to run the program for a subset of the records - close it - then open it again and run it for the next 'X' records - and repeat until I complete all of them... But this is a short term solution and I need a real fix.

Thank you

Bradley MacDonald

  • Just for further clarification - the Oracle and MSSQL servers are on other machines - so they are not using up memory on this machine. – G Bradley MacDonald Apr 13 '23 at 21:05
  • Provide an [MRE](https://stackoverflow.com/help/minimal-reproducible-example) - this way you also ensure to sort out many other potential culprits. Not getting any leaks reported is no proof that you're treating memory correctly - you could still forget to close/release hundreds of handles. The versions of anything you use (DBMS, drivers, OS...) might be relevant, too. – AmigoJack Apr 14 '23 at 01:01
  • I never reuse the Query components I always create-bindtoconnection-use-free them dynamically for every query I do. You might want to try that. I do keep the connection components. – Pieter B Apr 14 '23 at 07:49
  • UniDac version? Googling for 'delphi unidac memory leak' shows me e.g. https://forums.devart.com/viewtopic.php?t=33658 And did you search their forum? https://forums.devart.com/viewforum.php?f=28 – Jan Doggen Apr 14 '23 at 08:19

1 Answers1

0

To investigate the issue, we need a simple example of an application that experiences memory leaks when executed. Please contact our support team to address this matter.

Devart
  • 119,203
  • 23
  • 166
  • 186