Page 1 of 1

Memory Out

Posted: Fri Oct 30, 2015 7:03 pm
by Ceprotec
I'm trying to open the following file.

Image

This file contains 250 images.

But the following error occurs:

Image
Image


Already tried using:
SRichViewEdit1.LoadRVF(Caminho);
and:
rvActionOpen1.LoadFile(SRichViewEdit1.RichViewEdit, Caminho, ffiRVF);

Posted: Sat Oct 31, 2015 11:03 am
by Sergey Tkachenko
The current version of TRichView loads all images in memory, creating graphic objects for them.
Unfortunately, this problem cannot be solved in the current version of TRichView.
If the document has many identical pictures, some optimizations are possible, but if all pictures are different, this problem is unavoidable.

In future versions, we plan to optimize memory usage for pictures, graphic objects will be created only for the most recently used pictures. But I cannot tell when it will be implemented, sorry.

Posted: Sat Oct 31, 2015 12:39 pm
by Sergey Tkachenko
By the way, images of which type caused this problem?
If this is TGifImage, make sure that you included RVGifAnimate unit in your project, it optimizes memory usage for gif animations.

For any case, please send me a file causing this problem.

Posted: Sat Oct 31, 2015 5:34 pm
by Sergey Tkachenko
One more possible reason for "out of memory" error is a file corruption. So please send me this file for verifying it.

Posted: Sun Nov 01, 2015 7:58 pm
by Ceprotec
The images are in JPG.

The file is too large.

I believe that the file is not corrupted, I tried to open it with a demo, but some images were not loaded (it was the same error).

Google Translate, sorry.

Posted: Mon Nov 02, 2015 7:01 pm
by Sergey Tkachenko
I thought more about this problem, and probably I can implement a solution.
I'll try to solve it later in this week.

Posted: Mon Nov 02, 2015 10:54 pm
by Ceprotec
Ok.

When a very large file is opened, the RAM usage is high, is there any way to free this memory after this file be opened?

Thank you.

Posted: Tue Nov 03, 2015 8:57 am
by Sergey Tkachenko
The whole content of a file is loaded in memory, it is unavoidable.

The only thing that can do is optimizing working with images. TGraphic object can be created only for several recently used images. For other images, it can be created on demand.

For small documents, it will increase memory usage, because we need to store image both in TGraphic object and in a memory stream. But documents containing many images will require much less memory and resources.

Posted: Tue Nov 03, 2015 12:35 pm
by Ceprotec
https://youtu.be/xAuBMQvchQk

Is there any solution to the video problem?

Posted: Tue Nov 03, 2015 1:15 pm
by Sergey Tkachenko
It may be caused either by memory leak or by a bad memory manager in the old version of Delphi.
There are no known memory leaks in the newest version of TRichView.
To understand the problem, I need your file. You can upload it (zipped) to some web server and give me a link. If you need, I can give you ftp account on trichview.com to upload this file.

Posted: Tue Nov 03, 2015 1:40 pm
by Ceprotec
I sent the file by PM.