Zeos 7.0.3 TZTable; Huge memory consumption
Posted: 21.03.2014, 11:16
Hi everyone,
we are in the process of moving our application from Delphi 7 to Delphi XE3. In Delphi 7 we used the Borland Database Engine (BDE) as data connector to a SQL database (MySQl, MSSQL). In Delphi XE3 we replaced BDE with Zeos Components. The code is constructed upon TZTables. Most data access is handled over those tables which are created on application launch.
We have a huge memory consumption issues using those TZTables. Our application which maybe uses 200MB needs several hundreds MB just for a couple TZTables. A 60 MB SQL dump needs over 1GB in total application memory. I don't know why but it seems 1GB memory consumptions seems to be some kind of limit even after I set a Delphi flag to use up to 3GB on 32Bit systems. Hitting (and exceeding) that limit makes the application incredible slow as it's using one full CPU core just to "fetch" data.
I analysed the TZTable memory issue itself. It seems Zeos is preallocating ALL the space of an DB entry, even if it's not (fully) used. So e.g. you have a field varchar(200) Zeos seems to allocate memory for all those 200 signs (in Unicode) - even if the field is NULL or filled with 20 signs.
Are you aware of this issue? What is your recommendation?
Best Regards,
Andy
we are in the process of moving our application from Delphi 7 to Delphi XE3. In Delphi 7 we used the Borland Database Engine (BDE) as data connector to a SQL database (MySQl, MSSQL). In Delphi XE3 we replaced BDE with Zeos Components. The code is constructed upon TZTables. Most data access is handled over those tables which are created on application launch.
We have a huge memory consumption issues using those TZTables. Our application which maybe uses 200MB needs several hundreds MB just for a couple TZTables. A 60 MB SQL dump needs over 1GB in total application memory. I don't know why but it seems 1GB memory consumptions seems to be some kind of limit even after I set a Delphi flag to use up to 3GB on 32Bit systems. Hitting (and exceeding) that limit makes the application incredible slow as it's using one full CPU core just to "fetch" data.
I analysed the TZTable memory issue itself. It seems Zeos is preallocating ALL the space of an DB entry, even if it's not (fully) used. So e.g. you have a field varchar(200) Zeos seems to allocate memory for all those 200 signs (in Unicode) - even if the field is NULL or filled with 20 signs.
Are you aware of this issue? What is your recommendation?
Best Regards,
Andy