Page 1 of 1

Too much memory usage

Posted: 25.01.2006, 18:09
by Alfonso
I have build in Delphi 2006 a very little test application with one dbgrid, one TZQuerys and one connection to MySQL4.

When I run the application, the memory usage (seen in Taskmanager) swaps between 4.460 KB (no TZQuery active) to 55 MB up to 250 MB, depending on the number of rows in the table. (The maximum no. is 10 rows!)

If I perform the SQL-Query for 10 rows direct in PHPMyAdmin and export the result as XML, the file is only 13 KB!

Do you have an idea, why the components uses so much memory?

On systems with low memory, windows is swaping and is very slow.

bye
Alfonso

Posted: 26.01.2006, 11:03
by zippo
D6 and MySQL 3.23.58 and MySQL 5.0 - never noticed this problem. There are small memory leaks, but nothing like this!

The memory leak comes only with "IF" inside a &quo

Posted: 26.01.2006, 12:22
by Alfonso
I have this SQL Statement:

Code: Select all

ZQContent.SQL.Text:='SELECT '+
            'if(X_LineItemNote=" ",X_Bestelltext, ' +
            'X_LineItemNote) AS Beschreibung ' +
            'FROM  CM_tbl_Content WHERE idHeader=:idHeader';
With this query, the program uses very huge memory (200 MB and more).

If I remove the IF, like here:

Code: Select all

ZQContent.SQL.Text:='SELECT '+
            'X_LineItemNote AS Beschreibung ' +
            'FROM  CM_tbl_Content WHERE idHeader=:idHeader';
The memory usage is now normal.

any idea? Is this a bug in ZEOS?

bye

Alfonso

Posted: 26.01.2006, 12:30
by zippo
What't the application that uses memory - your application or MySQL service? I can't understand why just a conditional line should affect memory usage, if the result is practically the same...

Sorry, I don't know how to help you, coz' I never had such a problem...

Posted: 26.01.2006, 13:46
by Alfonso
The application is using the memory. MySQL is running on a external server.
Try to create a simple application with a grid and a TZQuery. Insert an IF, like I did.

We have this problem since we switched to Delphi 2006 and to Zeos 6.5.1.

I tried to chang the SQL statement deleting the WHERE clause: The Computer (with 1 GB Memory) runs out of memory!

As you say, it is no logical, why just a conditional line should affect memory usage, if the result is practically the same ...

But it is so.

bye

Alfonso

Posted: 28.01.2006, 20:37
by MarkusD
Hello Alfonso,

perhaps MySQL can't determine the column size on the if statement and therefore reports a very large one. What column type is Beschreibung with and without if?
Perhaps you can use a typecast ( e.g. varchar(255))?
Sorry if i'm wrong, i don't have any experience with MySQL but imho it seems the first thing to check.

Best Regards,
Markus Dütting

Posted: 21.02.2006, 07:31
by rchurch
Alfonso I suggest you strip down your program to the bare minimum required for someone else to try and replicate your bug and post it. Add the sql definitions, database versions etc.
Alfonso wrote:The application is using the memory. MySQL is running on a external server.
Try to create a simple application with a grid and a TZQuery. Insert an IF, like I did.

We have this problem since we switched to Delphi 2006 and to Zeos 6.5.1.

I tried to chang the SQL statement deleting the WHERE clause: The Computer (with 1 GB Memory) runs out of memory!

As you say, it is no logical, why just a conditional line should affect memory usage, if the result is practically the same ...

But it is so.

bye

Alfonso