[Rd] memory leak in png()
Edward Ionides
|on|de@ @end|ng |rom um|ch@edu
Mon Jan 16 15:04:49 CET 2023
Hi all,
Yesterday I discovered what seems to me like a memory leak in png() so I'm
reporting it in case that is helpful. Here is a small reproducible example:
R -d "valgrind --tool=memcheck --track-origins=yes --leak-check=full"
--vanilla -e "png(filename='p.png'); plot(1:10); dev.off()"
## HAS LEAK
==1021711== LEAK SUMMARY:
==1021711== definitely lost: 9,216 bytes in 30 blocks
==1021711== indirectly lost: 19,370 bytes in 838 blocks
==1021711== possibly lost: 3,868 bytes in 8 blocks
R -d "valgrind --tool=memcheck --track-origins=yes --leak-check=full"
--vanilla -e "pdf(file='p.pdf'); plot(1:10); dev.off()"
## NO LEAK
==1031300== LEAK SUMMARY:
==1031300== definitely lost: 0 bytes in 0 blocks
==1031300== indirectly lost: 0 bytes in 0 blocks
==1031300== possibly lost: 0 bytes in 0 blocks
For some context, I am running R4.2.2. My goal was to run valgrind on the
latest version of my spatPomp package. A memory leak was detected by
rhub::check_with_valgrind(). I then tracked down the problem by running
valgrind locally and in the end it seemed to come down to a problem with
png(). This was used in the spatPomp unit tests while testing the plot
method. I can use pdf() instead, but the point here is to report the issue
in case it is not known.
I'm new to R package development and happy to accept any advice.
Thanks,
Ed
Edward L. Ionides
Associate Chair for Undergraduate Studies and Professor,
Department of Statistics, University of Michigan
1085 South University, Ann Arbor, MI 48109-1107
email: ionides using umich.edu
phone: 734 615 3332
office: 453 West Hall
[[alternative HTML version deleted]]
More information about the R-devel
mailing list