Bug 418893 - Okular uses > 50% of RAM with setting "ram usage: greedy"
Summary: Okular uses > 50% of RAM with setting "ram usage: greedy"
Status: RESOLVED NOT A BUG
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.9.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-15 17:59 UTC by postix
Modified: 2022-06-02 18:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot (310.81 KB, image/png)
2020-03-15 17:59 UTC, postix
Details
Screenshot htop (606.82 KB, image/png)
2020-03-15 18:07 UTC, postix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2020-03-15 17:59:45 UTC
Created attachment 126820 [details]
Screenshot

SUMMARY

Despite the description saying that Okular uses 50% as the maximum of the total memory or available memory (whichever value is greater), it actually uses 71% (11 GB instead of 8 GB) in my case right now. I have two PDFs opened.

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.1
Kernel Version: 5.5.8-1-MANJARO
Memory: 15,4 GiB
Comment 1 postix 2020-03-15 18:07:58 UTC
Created attachment 126821 [details]
Screenshot htop

With 4 PDFs it starts swapping ...
Comment 2 Laura David Hurka 2020-03-15 18:43:47 UTC
Could the reason be that each individual Okular::Part uses 50% as maximum? (I. e. 50% for each opened file.)
Comment 3 postix 2020-03-15 20:13:23 UTC
Heres the original wording (https://docs.kde.org/trunk5/en/kdegraphics/okular/okular.pdf) *:

> Use Greedy profile to preload all pages without risk of system memory overfull (only 50% of total memory or free memory will be used).

Does this include swap memory? 

Let's make an example: If 16 GB Ram are installed and 4 GB are used by the system, 12 GB are available.
=> 50% of total memory = 8 GB and 50% of the available memory = 6 GB

1) If Okular now loads 1 PDF, will it use 8 GB or 6 GB? 

2) As it takes some time to fill the RAM, what happens if in the meantime the available RAM becomes occupied by another process
or more RAM available?

3) What should happen if a second PDF will be opened short after the 1st PDF?
How does Okular manage the RAM usage for both PDFs now in order to keep the memory usage under the limit?

(In reply to David Hurka from comment #2)
> Could the reason be that each individual Okular::Part uses 50% as maximum?
> (I. e. 50% for each opened file.)

That's a good question!

* I now see that the German translation is not very accurate. In the original it doesn't say "whichever value is bigger" as I claimed in the opening post.