Pandoc & Rstudio Knitr Memory Leak

I am trying to link a .Rmd file on a private ubuntu amazon ec2 instance with 15 GB of memory. I installed rstudio (RStudio 0.99.903 - Ubuntu 12.04 + / Debian 8+ (64-bit)) from the source without any problems, and then linked the companion version of pandoc after.

$ 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

And confirmed it in PATH

ubuntu@ip-172-31-46-87:~$ pandoc -v
pandoc 1.15.2

Calling knitr from the command line

Rscript -e "rmarkdown::render('Observed.Rmd')" &> run.txt

I can successfully knit small test runs.

However, when I try to do a larger run, I get an error

/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 

I tried to increase heap size following another SO question by adding in YAML

output: 
  html_document:
    keep_md: yes
    number_sections: yes
    theme: spacelab
    toc: yes
    pandoc_args: [
    "-M2GB", "+RTS", "-K64m", "-RTS"
    ]

I also tried

self_contained: no

From which I see that figures knit only 40 MB

ubuntu@ip-172-31-21-194:~/Whales$ du SingleSpecies_files/ -sh
40M     SingleSpecies_files/

In e2c, I track memory in increments of five minutes.

enter image description here

, knitr ( pandoc) , 10 . ? , , ggmap, . , , . .

, , knitr rstudio, rstudio , knitr?

+4
1

RStudio ubuntu 14.04, ubuntu :

Sys.setenv(LANG = "en")
Sys.setlocale("LC_TIME", "en_US")
0

Source: https://habr.com/ru/post/1653601/


All Articles