Collect garbage during pre-generation to free some space and reduce OOM problems

This commit is contained in:
Gaël C 2021-07-26 22:28:45 +02:00
parent f7bc5ee0b4
commit e3cadcdbc6

View File

@ -31,6 +31,7 @@ local function pregenerate(keep_loaded)
local ref_dem = model:define_isostasy(dem)
local tectonic_step = tectonic_speed * time_step
collectgarbage()
for i=1, niter do
print("[mapgen_rivers] Iteration " .. i .. " of " .. niter)
@ -43,6 +44,8 @@ local function pregenerate(keep_loaded)
end
model:isostasy()
end
collectgarbage()
end
model:flow()
@ -72,6 +75,7 @@ local function pregenerate(keep_loaded)
grid.offset_x = offset_x
grid.offset_y = offset_y
end
collectgarbage()
end
return pregenerate