Skip to content

Commit

Permalink
Set default 'cre_storage_size_factor' to 20 (#3732)
Browse files Browse the repository at this point in the history
Increase default crengine in-memory cache sizes to avoid pack/unpack
of chunks that is known to be the cause of bugs (rendering, cache
re-use...).
  • Loading branch information
poire-z committed Mar 8, 2018
1 parent 1606137 commit 5cd51ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/document/credocument.lua
Expand Up @@ -47,9 +47,17 @@ function CreDocument:cacheInit()
if lfs.attributes("./cr3cache", "mode") == "directory" then
os.execute("rm -r ./cr3cache")
end
-- crengine various in-memory caches max-sizes are rather small
-- (2.5 / 4.5 / 1.5 / 1 MB), and we can avoid some bugs if we
-- increase them. Let's multiply them by 20 (each cache would
-- grow only when needed, depending on book characteristics).
-- People who would get out of memory crashes with big books on
-- older devices can decrease that with setting:
-- "cre_storage_size_factor"=1 (or 2, or 5)
local default_cre_storage_size_factor = 20
cre.initCache(DataStorage:getDataDir() .. "/cache/cr3cache", 1024*1024*32,
G_reader_settings:nilOrTrue("cre_compress_cached_data"),
G_reader_settings:readSetting("cre_storage_size_factor"))
G_reader_settings:readSetting("cre_storage_size_factor") or default_cre_storage_size_factor)
end

function CreDocument:engineInit()
Expand Down

0 comments on commit 5cd51ea

Please sign in to comment.