Memory Problem each TMyDataset 8 MB

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Thomas J

Memory Problem each TMyDataset 8 MB

Post by Thomas J » Tue 07 Dec 2004 10:23

I am working with the C++ Builder 6 and MyDac Component 2.0.
After my application is started 170MB memory are used and from this 170MB use the TMyDataSet components 125MB. I don't have a huge project and I want to ask if 8MB for each TMyDataSet is normal?

I tested it in that way that I set all TMyDataSet components incative. Start the debugger and step over each line like
TMyDataSet->Active = true;
And after each Active = true; 8MB are gone to my app.

It is a small database with few tables and if you have e.g. 20 TMyDatSet it would mean that the application needs only for Db connection 160MB which will not work if you want to create a app for standard business with 50-60 tables.

Thanks for your help

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Re: Memory Problem each TMyDataset 8 MB

Post by Ikar » Wed 08 Dec 2004 11:03

Memory usage depends on the data retrieved on client side. Please specify if the volume of used memory is reduced if set LIMIT 0 in the queries.

Thomas J

Post by Thomas J » Wed 08 Dec 2004 16:04

Okay now no 8MB are allocated. But what will happen if I now access this tables? Will I get no record back from the component?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 09 Dec 2004 09:24

By default, used memory at client side will increase in proportion to amount of data that was requested.

You can decrease memory usage if to use FetchAll and Unidirectional properties.

Thomas J

Post by Thomas J » Thu 09 Dec 2004 12:12

Thanks a lot! last question. Why is the memory not impacted by the number of fields which I have defined in the filed list.
For example the table has 20 Fields and 18 of them are not needed (typically a listbutton) and it doensn't matter if I define in the field list the two or all fields.

Guest

Post by Guest » Thu 09 Dec 2004 12:14

Thanks a lot! last question. Why depends the acllocation of memory not by the number of fields which I have defined in the filed list.
For example the table has 20 Fields and 18 of them are not needed (typically a listbutton) and it doensn't matter if I define in the field list the two or all fields.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 09 Dec 2004 15:22

Memory usage also depends on MyDataSet.Options.ExtStrings.

Please specify what you mean on "field list" - fields list in SELECT or list of created TFields objects?

Thomas J

Post by Thomas J » Thu 09 Dec 2004 16:29

I add with the Field Editor of TMyTable component the fields which I want to view in my resultset. And these are from type TField like

TLargeintField *MyTable1firmakey;
TStringField *MyTable1firma;
TIntegerField *MyTable2kat_id;
TStringField *MyTable2kat_text;

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 10 Dec 2004 09:39

TMyTable retrieves all fields from the server. If you need only some of them please use TMyQuery.

Post Reply