Bug 14991 - pdf temporary files are not removed after calling dev.off()
Summary: pdf temporary files are not removed after calling dev.off()
Alias: None
Product: R
Classification: Unclassified
Component: Graphics (show other bugs)
Version: R 2.15.x
Hardware: All Linux
: P5 minor
Assignee: R-core
Depends on:
Reported: 2012-07-16 10:08 UTC by Sebastian Gibb
Modified: 2014-02-16 11:41 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Gibb 2012-07-16 10:08:15 UTC
When storing plots in a pdf R generates a temporary file (e.g. /tmp/RtmpFKQqjI/pdf317d27df81a0) for each plot. After drawing many plots into a pdf my /tmp partition runs out of memory and R stops working.

Steps to Reproduce:

for (i in 1:10) {
    pdf(file=paste(i, ".pdf", sep=""))

list.files(path=tempdir(), pattern="^pdf.", full.names=TRUE)
# [1] "/tmp/RtmpFKQqjI/pdf317d27df81a0" "/tmp/RtmpFKQqjI/pdf317d28ed0612"
# [3] "/tmp/RtmpFKQqjI/pdf317d295c2453" "/tmp/RtmpFKQqjI/pdf317d304bb025"
# [5] "/tmp/RtmpFKQqjI/pdf317d3332d7fe" "/tmp/RtmpFKQqjI/pdf317d3921428f"
# [7] "/tmp/RtmpFKQqjI/pdf317d4cf812ca" "/tmp/RtmpFKQqjI/pdf317d5082bebe"
# [9] "/tmp/RtmpFKQqjI/pdf317d560d326"  "/tmp/RtmpFKQqjI/pdf317d674b25ea"

Current workaround: 
unlink(list.files(path=tempdir(), pattern="^pdf.", full.names=TRUE))

Actual Results:
Each plot generates a temporary file which is not removed. (All temporary files would removed not before closing R.)

Expected Results:
Temporary files should be removed after plotting is finished (at least after calling dev.off()).

Build Date & Platform:
R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Comment 1 Duncan Murdoch 2012-07-20 20:00:33 UTC
Those files were used in producing compressed pdfs; I'll make sure they're deleted when done.  The fix will be committed soon.
Comment 2 Jackie Rosen 2014-02-16 11:41:49 UTC
(spam comment removed)