Hi all
Here is code that gradually eats up memory, whether run in GUI or as
command. All it does is creating temporary collections out of folders, and
writing them to file.
Is there a simple way to avoid this code to eat up memory? It runs out of
memory (set at 12GB for command, 18GB in GUI) after 300 folders or so, and
it has to process 20 000 of them.
Best
Lars G Johnsen
Norwegian National Library
Here is the actual code
(: process list of folders :)
for $collections in file:list($digibooks)
let $html := $htmlfiles || substring-before($collections, "_ocr") ||
".html"
return
(: code is rerun so check if files exist :)
if (not(file:exists($html))) then
try {
(: create a temporary collection of the files and write result
to disk :)
file:write(
$html,
db:digibok-to-html(
collection($digibooks || $collections))
)
} catch * {
$err:code
}
else
()