TRichviewEdit uses a lot of memory

General TRichView support forum. Please post your questions here
Post Reply
tomr
Posts: 21
Joined: Wed Dec 09, 2020 9:36 am

TRichviewEdit uses a lot of memory

Post by tomr »

Hello Richview Support,
when we start your demo (TRichView\Demos\Delphi\Editors\Editor 1\RVEditDemo.dpr) the application uses about 3MB of memory.
After we loaded a rtf-file (23MB) containing some large images and scrolled down in the editor the application uses about 225Mb of memory.
Is it a bug the application uses this large amount of memory?
We use version 18.6 of TRichview and Delphi Sydney.
We cannot attach mentioned rtf-file because its size exceeds the allowed 256 KiB.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TRichviewEdit uses a lot of memory

Post by Sergey Tkachenko »

Images need to be stored in memory. It is unavoidable.
Even for compressed graphic formats (like JPEG, PNG or GIF), VCL graphic classes create uncompressed bitmaps to draw themselves, and they may occupy a lot of memory.

PS: When the number of images in a document becomes too large, TRichView destroys some graphic objects and store them in streams to prevent "out of resources" error.
You can define the maximum number of active images in documents by assigning RichViewMaxPictureCount global variable (defined in RVGrCache.pas).
The default value is 100.
If you decide to decrease it, please take performance into account, because if TRichView will need to unpack/repack images too often, drawing will be slower.
tomr
Posts: 21
Joined: Wed Dec 09, 2020 9:36 am

Re: TRichviewEdit uses a lot of memory

Post by tomr »

Ok, thank you for the fast reply and the additional information.
Post Reply