diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-02-23 18:08:41 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-02-23 18:08:41 +0100 |
commit | c3ae4997f73041c6b97d8aec055ba24096602ab4 (patch) | |
tree | ef061c3ce83992da9beb0557dd7e4dfeedae3107 /tex/context/base/mkiv/data-tmp.lua | |
parent | bc35fdf25e8326c543ea69622d804e211232214a (diff) | |
download | context-c3ae4997f73041c6b97d8aec055ba24096602ab4.tar.gz |
2021-02-23 17:44:00
Diffstat (limited to 'tex/context/base/mkiv/data-tmp.lua')
-rw-r--r-- | tex/context/base/mkiv/data-tmp.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tex/context/base/mkiv/data-tmp.lua b/tex/context/base/mkiv/data-tmp.lua index 9b0117c15..9a8a586cd 100644 --- a/tex/context/base/mkiv/data-tmp.lua +++ b/tex/context/base/mkiv/data-tmp.lua @@ -324,7 +324,11 @@ caches.setluanames = setluanames -- -- runtime files like fonts are written to the writable cache anyway +local checkmemory = utilities and utilities.lua and utilities.lua.checkmemory +local threshold = 100 -- MB + function caches.loaddata(readables,name,writable) + local used = checkmemory and checkmemory() if type(readables) == "string" then readables = { readables } end @@ -352,7 +356,11 @@ function caches.loaddata(readables,name,writable) end if loader then loader = loader() - collectgarbage("step") + if checkmemory then + checkmemory(used,threshold) + else -- generic + collectgarbage("step") -- option, really slows down! + end return loader end end |