Page 1 of 1

Table Open/Close causes memory leak if not Direct

Posted: Wed 30 Dec 2015 03:49
by corneliusd
I'm using UniDAC Pro 6.2.9 in Delphi 10 Seattle with the SQLite provider and hunted down the source of a memory leak in my application to a simple open/close of the TUniTable component.

The application is compiled using packages and in fact this particular set of code is in a .DLL loaded by the main application (all written in Delphi). Some of the code uses TUniSQL to execute UPDATE statements, but there's one small procedure that simply opens a table, appends a record, posts, and closes it. I was getting a memory leak and finally traced it down to that one procedure. If I commented everything out except the table .Open and table .Close, it still got the memory leak until I commented those lines out as well.

I tried some of the SpecificOptions in the TUniConnection component and discovered that if I set "Direct=True" (for the SQLite provider), then the memory leak went away when using Open/Close.

So this raises two questions in my mind:
  • What are the pros/cons of using Direct mode? The help file simply says it will connect directly and not use the SQLite3 client library, but is there any drawback to that?
  • Is this a bug in how the open/close methods of the TUniTable are implemented for the SQLite provider or is it something the client library affects somehow?
Thanks,
David.

Re: Table Open/Close causes memory leak if not Direct

Posted: Wed 06 Jan 2016 14:07
by MaximG
1. Yes, indeed, Direct Mode in UniDAC components is implemented by embedding the SQLite client library code. The UniDAC 6.2.9 version is based on the SQLite engine version 3.9.2. The main advantages of using Direct Mode is that you don't need to connect third-party libraries to the project, and the support for Database File Encryption: https://www.devart.com/litedac/docs/?da ... yption.htm
2. We have checked the memory leaks when using UniDAC 6.2.9 in Direct Mode, and in the standard connection of SQLite client library Version 3.9.2, and found no problems. Make sure that you use the latest version of the SQLite client library : http://www.sqlite.org/download.html. If the problem is reproduced on the latest version of SQLite - make up a small example demonstrating the problem and send it to maximg * devart * com

Re: Table Open/Close causes memory leak if not Direct

Posted: Wed 06 Jan 2016 16:05
by corneliusd
Thanks for the reply. I think I will keep using Direct mode in this project as I tend to keep UniDAC updated more frequently than the SQLite DLL. And speaking of that, I checked my version and found I was using SQLite 3.8 from several months ago. When I upgraded the DLL to 3.10 and tried it again, the memory leak went away. 8)

Thanks,
David.

Re: Table Open/Close causes memory leak if not Direct

Posted: Fri 08 Jan 2016 09:22
by MaximG
We are glad to see the problem resolved. Please don't hesitate to contact us with questions concerning UniDAC usage