When using TMyEmbConnection I see that upon first opening of the database, it uses 32000 file handles.  Even if I Free the TMyEmbConnection instance, the file handles remain.
My application runs OK, but between the 32000 initial file handles and apparent slow leakage during database access, I am concerned that it will eventually run out of handles and die.
I am using v8.4.13 in DXE.
Any ideas?
			
									
									
						TMyEmbConnection and file handles
Re: TMyEmbConnection and file handles
MyDAC does not unload Embedded server every time after closing a connection because this is a very slow operation. If you really need to release database files during your application is working, you should add the MySqlApi unit to the uses clause and execute this code: 
In addition, the UnloadEmbLibraryOnDisconnect global variable is declared in the MySqlApi module. Its default value is False. You can set UnloadEmbLibraryOnDisconnect to True for unloading MySQL Embedded server library on closing connection.
			
									
									
						Code: Select all
  MyAPIEmbedded.FreeMySQLLib;Re: TMyEmbConnection and file handles
Thank you!  I will give it a try.
In my case, datamodules are created in threads. When the thread terminates and the datamodule is freed, I need to close the file DB file handles.
			
									
									
						In my case, datamodules are created in threads. When the thread terminates and the datamodule is freed, I need to close the file DB file handles.
Re: TMyEmbConnection and file handles
In this case, to free file handlers after freeing all threads, you can call the MyAPIEmbedded.FreeMySQLLib method in the main thread.