summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua b/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua
index 9b0117c1562..9a8a586cda4 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua
+++ b/Master/texmf-dist/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