Technical reference documentation

Introduction

This page gathers some more technical aspects of the rClr package, and is not meant to be read by most users. One aim is to document a few processes such as the build process.

Build process

.Rd file documentation

library(devtools)
install_github("jmp75/rclr-devtools/packages/rClrDevtools")
library(rClrDevtools)  # https://github.com/jmp75/rClr-devtools
roxyRclr()
# roxyRclr(pkgDir='~/src/codeplex/rClr')

Vignettes

You should start from a new R session; if you have regenerated doc from Roxygen, there may be some surprises with the result of the system.file function.

library(rClrDevtools)  # https://github.com/jmp75/rClr-devtools
library(rClr)
pkgDir <- tryFindPkgDir()
# seem to need to move working directory. Oddities with knitr figure
# output otherwise
originalDir <- getwd()
docDir <- file.path(pkgDir, "inst", "doc")
setwd(docDir)
vignettesRclr()
set R="c:\Program Files\R\R-3.1.2\bin\x64\R.exe"
if not exist %R% set R="c:\Program Files\R\R-3.1.2\bin\i386\R.exe"
cd F:\src\codeplex
:: set BuildConfiguration=Debug
rm -rf rClr.Rcheck
del rClr_0.*.tar.gz
del rClr_0.*.zip

Note that a call to R CMD build will now build the vignettes too, so maybe vignettesRclr is redundant.

%R% CMD build rClr > logbuild.txt 2>&1
%R% CMD check --as-cran rClr_0.*.tar.gz > logcheck.txt 2>&1
%R% CMD INSTALL --build rClr_0.*.tar.gz
> setwd('c:/src/codeplex/rClr')
> tools::buildVignettes(dir='.', tangle=TRUE)
Quitting from lines 224-232 (rclr_intro.Rmd) 
Error: processing vignette 'rclr_intro.Rmd' failed with diagnostics:
argument is of length zero
library(rClrDevtools)
cpDebugBins()
library(testthat)
test_package("rClr")

Diagnosing

Have warnings, but by defaults could not see where, what. The following treats warnings as errors:

options(warn = 2)
test_package("rClr")
# restore:
options(warn = 0)

Had an issue with memory footprint on 2015-03-26. A way to diagnose things:

library(rClr)
cTypename <- "Rclr.TestCases"
testClassName <- "Rclr.TestObject"
callGcMethname <- "CallGC"
forceDotNetGc <- function() {
    callTestCase(callGcMethname)
}
forceGc <- function() {
    gc()
    forceDotNetGc()
    gc()
    forceDotNetGc()
}

callTestCase <- function(...) {
    clrCallStatic(cTypename, ...)
}

blah <- clrCallStatic(cTypename, "CreateArrayMemFootprint", 100L * 1024L * 1024L)
forceGc()
forceGc()
clrCallStatic(cTypename, "SinkLargeObject", blah)
forceGc()
forceGc()
rm(blah)
forceGc()
forceGc()