[Okular-devel] [Bug 291129] Okular easily occupies huge memory after scrolling in pdf files

Benni Hill benni at mytum.de
Tue Jun 26 00:32:39 UTC 2012


https://bugs.kde.org/show_bug.cgi?id=291129

--- Comment #19 from Benni Hill <benni at mytum.de> ---
(In reply to comment #18)
> The swapped memory is "substracted" from the free memory because we don't
> want to prevent swapping in of any program that might be swapped out to be
> slow or to end up putting okular stuff in the swap.

I understand, but in this case SwapCached should also be considered then.
According to [1] SwapCached is "Memory that once was swapped out, is swapped
back in but still also is in the swapfile (if memory is needed it doesn't need
to be swapped out AGAIN because it is already in the swapfile. This saves
I/O)". So SwapCached could be added to memoryFree because it's already in
physical memory.

But I would prefer to change the behavior of getFreeMemory:
Instead of a program that is swapping in, the memory could also been taken away
by a program that is just starting up. To detect this okular is already polling
the memory usage every 2 s (if I get this right). So why can't we detect
programs that are swapped in, this way? I would propose to just poll the
physical memory usage (perhaps faster) and check if (freePhysicalMemory <
fraction*totalPhysicalMemory) with fraction ~0.5 or so. If thats the case then
we free some memory.

And finally: Shouldn't getFreeMemory behave consistently on all platforms?
(BTW: Is Mac OS X missing?)


Another thing related to memory usage:
In DocumentPrivate::cleanupPixmapMemory when set to Greedy:
memoryLimit = qMin( qMax( freeMemory, getTotalMemory()/2 ), freeMemory+freeSwap
);

Let's assume freeSwap = 10 GB, freeMemory = 1 GB and totalMemory = 8 GB, then
memoryLimit would be totalMemory/2 (= 4 GB) and would result in swapping? Or do
I understand this wrong?



[1]: https://lwn.net/Articles/28345/

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list