Page 1 of 1

Memory Problem each TMyDataset 8 MB

Posted: Tue 07 Dec 2004 10:23
by Thomas J
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

Re: Memory Problem each TMyDataset 8 MB

Posted: Wed 08 Dec 2004 11:03
by Ikar
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.

Posted: Wed 08 Dec 2004 16:04
by Thomas J
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?

Posted: Thu 09 Dec 2004 09:24
by Ikar
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.

Posted: Thu 09 Dec 2004 12:12
by Thomas J
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.

Posted: Thu 09 Dec 2004 12:14
by Guest
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.

Posted: Thu 09 Dec 2004 15:22
by Ikar
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?

Posted: Thu 09 Dec 2004 16:29
by Thomas J
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;

Posted: Fri 10 Dec 2004 09:39
by Ikar
TMyTable retrieves all fields from the server. If you need only some of them please use TMyQuery.