rnote icon indicating copy to clipboard operation
rnote copied to clipboard

High memory usage

Open Danacus opened this issue 2 years ago • 7 comments

Describe the bug

In some documents (with a lot of written text and images), memory usage jumps to multiple gigabytes when panning and zooming out aggressively.

To Reproduce

I don't really know which things in the document are causing the issue, but I can provide a document that triggers the issue (it's some notes I took while studying for an exam, shouldn't contain anything sensitive).

dss.zip

Steps to reproduce the behavior:

  1. Open the provided file
  2. Zoom in and start panning the window
  3. Zoom out as far as you can
  4. Repeat until memory usage increases to multiple gigabytes. It may take a little while to reproduce (a few minutes at most), but after a seemingly random amount of time, memory usage instantly jumps from around 1.5GB to 4GB.

Expected behavior

I expected memory usage to be much lower.

Console Output

Nothing besides the initial log message: DEBUG rnote::app::imp > ... env_logger initialized.

Desktop:

  • OS: Fedora Linux
  • Version: 37
  • Installation source: Flatpak (Rnote 0.5.12)
  • Desktop Environment: GNOME 43.2

Additional context

I don't know what exactly causes it. Maybe some tools can be used to figure out what's consuming so much memory?

Danacus avatar Jan 20 '23 08:01 Danacus

I can reproduce this sometimes like you described. I don't have a solution yet, it needs a more detailed look into it. There are also plans to swap out cairo wiht a GPU-based renderer eventually (vello, maybe) that should make it possible to reduce memory usage while keeping performance high.

flxzt avatar Jan 22 '23 16:01 flxzt

Is there any progress on this? I have a certain type of PDF which always cause huge memory usage (~10-15 GB) even though the PDF itself is like ~10 MB and nothing is done besides importing. It always happens with the PDFs I receive from the same person, so I guess something about the way they / their software exports these PDFs causes this. It also drastically reduces performance to the point where the CPU is pinned to 100%, and I have to wait for a minute for just a single page of the PDF displaying, and they always immediately get unloaded when scrolling, so usability is practically 0. Regular PDF viewers or say Xournal++ don't have the same issues with these PDFs.

RayJW avatar Dec 01 '23 14:12 RayJW

Can you share the Pdf that causes this?

flxzt avatar Dec 03 '23 14:12 flxzt

I can share some but ideally privately. Can I send you access via a Mastodon DM?

RayJW avatar Dec 03 '23 14:12 RayJW

Is it not possible to generate a file that reproduces this and doesn't have sensitive information on it? Then it might be easier in the case where it is an issue with the underlying image simplification library/rendering library. But if not sharing it privately is also fine

flxzt avatar Dec 03 '23 14:12 flxzt

I don't know how this file is generated but it's not specifically sensitive. Just a question of privacy :)

RayJW avatar Dec 03 '23 14:12 RayJW

Here is a file that makes Rnote go up to 3.5GB of ram for me: Übungen-S103-104.pdf, this is a rather mild example but it's all I can find right now that doesn't have sensitive information in it, I have other files that exceed it to the point of Rnote being killed for using too much. I think the issue is with PDF files that have raster images in them, especially document scans made with android apps such as Microsoft Lens.

fruityloops1 avatar Feb 09 '24 08:02 fruityloops1