From c3ae4997f73041c6b97d8aec055ba24096602ab4 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 23 Feb 2021 18:08:41 +0100 Subject: 2021-02-23 17:44:00 --- tex/context/base/mkiv/data-tmp.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tex/context/base/mkiv/data-tmp.lua') 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 -- cgit v1.2.3