Too much memory usage

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Alfonso
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 13.09.2005, 09:47

Too much memory usage

Post 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
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post 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!
Alfonso
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 13.09.2005, 09:47

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

Post 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
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post 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...
Alfonso
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 13.09.2005, 09:47

Post 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
MarkusD
Zeos Dev Team
Zeos Dev Team
Posts: 20
Joined: 28.08.2005, 03:40
Location: Ingolstadt

Post 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
rchurch
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 12.02.2006, 14:52

Post 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
Post Reply