[R] Processing repeated images and memory recovery by GC
Steve Rowley
@gr @end|ng |rom @|um@m|t@edu
Mon Sep 8 00:44:41 CEST 2025
On Fri, Sep 5, 2025 at 5:52 AM Ivan Krylov <ikrylov using disroot.org> wrote:
> В Thu, 4 Sep 2025 17:16:15 -0400
> Steve Rowley via R-help <r-help using r-project.org> пишет:
>
> > Then I use erase.screen() to erase the previous
> > image, use plot() to set up a plotting area, and display the image
> > with rasterImage().
>
> erase.screen() works by drawing a background-coloured rectangle over
> the plot, so the previous images remain in the display list despite
> being completely over-painted:
>
Thank you very much!
This was indeed the issue. Like most bugs, it is in retrospect obvious,
but as Kierkegaard (approximately) said, we don't live in retrospect. :-)
I used dev.control(displaylist = "inhibit") on the screens created by
split.screen(). This leads to some redisplay problems if the window is
resized, but other than that everything seems to work and I'm happy to live
with that little problem. (Possibly MacOS is doing some redisplay work
here in the background.)
Reporting memory size after each iteration shows it operates in
approximately constant memory now. ("Approximately" means that it does
expand a bit for larger images, but GC works to retrieve the memory, so
that's ok.)
Thanks to all who offered an opinion. (Or even thought about it, that sort
of kindness counts too!).
And especial thanks to Ivan for nailing the problem exactly, just from my
vague description. I'm really, really impressed with your debugging
prowess.
___________
Steve Rowley <sgr using alum.mit.edu> Zoom: 839 529 4589
<https://us04web.zoom.us/j/8395294589?pwd=dlQ4MUFHK1NFOCtoZFpUNFRtZ2lSQT09>
It is very dark & after 2000. If you continue, you are likely to be eaten
by a bleen.
[[alternative HTML version deleted]]
More information about the R-help
mailing list