memory handing and problems #79
Comments
Are you referring to change the default value on the fly(before every document open) or just before kindlepdfview starts? |
I think that getting free memory has to be done in lua, before first document is loaded, but re-distribution between buffers of that value should be done on each document open (for change between pdf and djvu #80 for example) Even better, we can also check document size on open, and it's really massive ask user if they want to stop kindle framework to gain additional memory. |
That will some how make the memory cache uncontrollable by users. So we need a very intelligent auto cache setting system if take this approach. Also I notice that it is hard to predict memory usage according to file size. One of the file in our share point is only 3M, but still can leads to reboot. And another 100M pdf file of mine consumes less memory than that one. :( |
Here is an interesting observation in respect to the memory issues I am experiencing... |
nice catch @vdp! |
Just fixed a bug in pull request #84. The GC circle seems too long and before it do a collection, the size for biltbuffer userdata has already exceed the |
@vdp can you try https://github.com/downloads/dpavlin/kindlepdfviewer/kindlepdfviewer-b4bf2e5.zip This includes @houqp fix #84 and memory usage on menu key. It seems to work nice in my limited testing on DXG. |
Thank you very much @houqp and @dpavlin ! |
@vdp , we owe you a lot for the testing work and the Just one more note, seems that djvulibre and mupdf uses cachesize differently. Given the same cachesize, djvu will consume more memory. So the default cachse size for djvu is 10M, while mupdf is 64M. So if the memory usage is too high for you when reading djvu, you may want set two different document cache size for each format. |
Thanks, I will take this into account if I run into RAM-related issues with DJVU. |
I managed to parse local mem_free = 8 * 1024 * 1024 -- 8Mb default
for line in io.lines("/proc/meminfo") do
local kb = tonumber(line:match("MemFree: *([%d]+) kB"))
if kb then mem_free = kb * 1024 end
end
print("Free memory "..mem_free.." bytes") I think it would be save to use |
Here is my two cents. I think we should respect users' choices, i.e. use We can add a |
I would like to simplify current configuration, not to introduce two more configuration variables :-) But we could decrease user supplied values if there isn't enough memory? This seem like better solution that OOM killer which looks very scary to users, especially on DXG where memory is tight:
In fact, I might need to add in Cached to MemFree just to get some reasonable amount in DXG... And if it's under configured Seems reasonable? |
Ok, that makes sense. I would suggest we try it out first :) |
there are too many memory knobs as described by our problem to communicate correct settings on mobileread forum http://www.mobileread.com/forums/showpost.php?p=2023375&postcount=194
Right now, we in
unireader.lua
we have:but we also have in
pdfreader.lua
:It seems to me that we need to do
grep MemFree /proc/meminfo
as sane default value (in lua, somehow :-) and then assign that in some ratio tocache_max_memsize
,cache_item_max_pixels
and mupdf if we are viewing pdf file (otherwise, it would be nice to have more memory for first two variables).Any takers?
The text was updated successfully, but these errors were encountered: