Reduce memory usage after opening query with many records

668 Views Asked by At

I did a small test project where I have an FDConnection component (connected to a MySQL database) and an FDQuery, the FDQuery menu SQL is as follows:

SELECT * FROM products

This query brings 6000 records. When I run my test the memory used is 2MB (when starting the query it remains closed). I have a TButton that has the following code:

if qrProducts.Active then
   qrProducts.Refresh
else
   qrProducts.Open;

When clicking on the button once, the memory goes up to 12MB, then with each click that I give again, the memory goes up 1.5MB until reaching approximately 30MB. I have another TButton that has the following code:

qrProducts.Close;

When closing the query the memory usage drops to 21MB.

This behavior is normal, would it be a Firedac cache? I was wondering what can be done to get the system back to the initial 2MB, if it can be done?

0

There are 0 best solutions below