animate_frames() iterates through the frames produced by frames_spatial() and writes them incrementally to a temporary directory. The PNG graphics device is only closed at the conclusion of the loop, after all frames are rendered:
|
file <- file.path(frames_dir, "frame_%05d.png") |
|
grDevices::png(file, width = width, height = height, res = res) |
|
graphics::par(ask = FALSE) |
|
.lapply(1:length(frames), function(i){ |
|
quiet(print(frames[[i]])) |
|
}, moveVis.n_cores = 1) |
|
grDevices::dev.off() |
It seems that each rendered frame persists in memory until the device is turned off and for large animations can exhaust the available memory. Fixing this may be as simple as moving the graphics rendering code inside the loop.
animate_frames()iterates through the frames produced byframes_spatial()and writes them incrementally to a temporary directory. The PNG graphics device is only closed at the conclusion of the loop, after all frames are rendered:moveVis/R/animate_frames.R
Lines 113 to 119 in cf88cdc
It seems that each rendered frame persists in memory until the device is turned off and for large animations can exhaust the available memory. Fixing this may be as simple as moving the graphics rendering code inside the loop.