I'm using in-memory SQLite databases with AnyDac on Delphi XE2. I noticed that my queries return results even when I forget to connect the database first after restarting the program, which is probably caused by the autoconnect capability of AnyDac. The thing is that I guess that this must also mean that the in-memory databases stay in memory even after the program itself has terminated, which is kind of a memory leak.
I looked through the AnyDac documentation and searched online, but I could not find any way of how I am supposed to disconnect from a database using AnyDac correctly. I noticed that when I call the "close" method of a TADConnection the sqlite file seems to stay open. I guess the same happens with my in-memory databases.
Can anyone please tell me how to completely close, disconnect from and remove a in-memory SQLite database in a correct and safe way?
ADConnection.Close
completely remove in-memory SQLite DB. With nextADConnection.Open
, explicitly or implicitly, new empty in-memory DB is created.This can be easy confirmed by simple test: