Page 1 of 1

TRichviewEdit uses a lot of memory

Posted: Wed Jun 23, 2021 8:33 am
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.

Re: TRichviewEdit uses a lot of memory

Posted: Fri Jun 25, 2021 1:37 pm
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.

Re: TRichviewEdit uses a lot of memory

Posted: Mon Jun 28, 2021 9:31 am
by tomr
Ok, thank you for the fast reply and the additional information.