Out of memory with large count of records with BLOBs

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
sglodek
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 13.02.2020, 20:08

Out of memory with large count of records with BLOBs

Post by sglodek »

Hello,

I use ZEOSLib 7.2.6 stable in Delphi 2010 to create a report (FastReports Release 6) with about 1.000 ID-cards with a photography on the card. Database is Firebird 2.5. The report selects about 1.000 records each with a picture in a blob filed. The picture-size is about 250kbytes as .jpg-file, so the report / datasource will use 250MBytes for the pictures.

During report-creation there is an "out of memory" exception. I sent a small example-project to fast-report and they told me that the error occures in the datasource and not in the report-component. It crashes after loading abut 500 ID-cards.

The computer has 16GByte of memory and Delphi2010-applications (as 32bit-applications) should be able to handle 4GBytes.

Are there any special settings for ZConnection or ZQurey to handle queries with many records and contained large blobs?

I tried the following without any change in number of successfully loaded records:
- ZQuery-Options doCachedLobs
- ZQuery fetchRow with values of 10, 100, 500

The sql is like this (simlified here but there are only some more text-fields in the original query):
select lastname, picture from persons;

A Delphi TDatasource-component is linked to the TZQuery and the report uses this TDatasource to get the records from the database.

Do you need more informations to give me a hint for solving the problem?

Many thanks,

Siegbert
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: Out of memory with large count of records with BLOBs

Post by marsupilami »

Hello Sigbert,

I may be wrong but with Firebird BLOBs should not be cached, when setting doCacedLobs to false. In this case, BLOBs should always be fetched from the database if you need them. There couold be some inprovements for this use case in the current SVN version of Zeos 7.2.
If this doesn't work out, you could try to see what happens if you do the job in a master - detail kind of way: Have e separate Query for the BLOB data and fetch the data for the current record in the AfterScroll event of TZQuery:

Code: Select all

procedure MasterQ.AfterScroll(DataSet: TDataSet);
begin
  BlobQ.Close;
  BlobQ.ParamByName('PersonID').Value := DataSet.FieldByName('PersonID').Value;
  BlobQ.Open;
end;
This should free the memory and only load the BLOBs you need.

Best regards,

Jan
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

Re: Out of memory with large count of records with BLOBs

Post by Fr0sT »

What happens if you just fetch all records in dataset without FR?
Do memory counters show correct values when you fetch 100, 200, 500 records without FR?
What memory counters show when you create report with maximal count of records that won't produce an error?
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 765
Joined: 18.11.2018, 17:37
Location: Hungary

Re: Out of memory with large count of records with BLOBs

Post by aehimself »

I am using Zeos to fetch 10k+ records with XMLs stored as BLOBs, with often being 14MB+ each without memory issues. I'm compiling 64bit apps, though.
Delphi 12.1, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmariadb.dll 3.3.8
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.13
- MSSQL 2012, 2019; sybdb.dll FreeTDS_2435
- SQLite 3.45.2
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: Out of memory with large count of records with BLOBs

Post by EgonHugeist »

@aehimself,
you are using 7.3(halfed memory for all column except lob's. They are shared since i know Zeos), sigbert is using the last "stable" release of 7.2.
Sigbert, what do you think about an upgrade to 7.3 and report the findings?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Post Reply