我试图在15GB内存的私有ubuntu amazon ec2实例上编织.Rmd文件.我从源代码安装了rstudio(RStudio 0.99.903 – Ubuntu 12.04 / Debian 8(64位))没有问题,然后在
here之后链接了伴随版本的pandoc.
$sudo ln -s /usr/lib/rstudio/bin/pandoc/pandoc /usr/local/bin $sudo ln -s /usr/lib/rstudio/bin/pandoc/pandoc-citeproc /usr/local/bin
并在PATH中确认了它
ubuntu@ip-172-31-46-87:~$pandoc -v pandoc 1.15.2
从命令行调用knitr
Rscript -e "rmarkdown::render('Observed.Rmd')" &> run.txt
我可以成功编织小型试运行.
但是,当我尝试更大的运行时,我得到错误
/usr/local/bin/pandoc +RTS -K512m -RTS SingleSpecies.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output SingleSpecies.html --smart --email-obfuscation none --self-contained -M2GB +RTS -K64m -RTS --standalone --section-divs --table-of-contents --toc-depth 3 --template /home/ubuntu/R/x86_64-pc-linux-gnu-library/3.3/rmarkdown/rmd/h/default.html --number-sections --variable 'theme:spacelab' --include-in-header /tmp/RtmpWXb9A4/rmarkdown-str58570a61934.html --mathjax --variable 'mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --no-highlight --variable highlightjs=/home/ubuntu/R/x86_64-pc-linux-gnu-library/3.3/rmarkdown/rmd/h/highlight --variable navigationjs=/home/ubuntu/R/x86_64-pc-linux-gnu-library/3.3/rmarkdown/rmd/h/navigation-1.0 Error: pandoc document conversion failed with error 127 Execution halted Warning message: system call failed: Cannot allocate memory
通过添加到YAML,我尝试增加堆大小,继另一个SO question之后
output: html_document: keep_md: yes number_sections: yes theme: spacelab toc: yes pandoc_args: [ "-M2GB","+RTS","-K64m","-RTS" ]
我也试过了
self_contained: no
从中可以看出,编织的数字总共只有40MB
ubuntu@ip-172-31-21-194:~/Whales$du SingleSpecies_files/ -sh 40M SingleSpecies_files/
在e2c上,我以五分钟的增量跟踪内存.
我可以看到knitr(或pandoc)开始吃掉内存,在五分钟内超过10GB.是什么造成这种泄漏?是的,有几十个数字,其中一些来自ggmap,但它们几乎没有考虑到所有的内存分配.我知道这不可重现,但我试图彻底.欢迎所有建议.
我怀疑,因为我在rstudio之外运行knitr,有一个rstudio环境变量可以稳定大型针织运行?
解决方法
将当前版本的RStudio用于ubuntu 14.04这两个命令中的任何一个都会使ubuntu在崩溃之前加载越来越多的内存:
Sys.setenv(LANG = "en") Sys.setlocale("LC_TIME","en_US")
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。