[Rd] xrealloc namespace conflict

Patrick Perry pperry at stern.nyu.edu
Sat May 6 17:36:09 CEST 2017


I have a package on CRAN now (corpus-0.3.1) that is currently failing 
tests on Linux, but passing on all other architectures:

https://cran.r-project.org/web/checks/check_results_corpus.html

I believe that the issue arrises from a namespace class between 
"xrealloc", which my package provides for internal use, but which R also 
seems to provide (possibly as part of TRE in src/extra/tre/xmalloc.c). 
It looks like my package is not picking up my custom xrealloc, but using 
an xrealloc provided by R.

Besides the fact that I am linking to the wrong xrealloc, I think my 
tests are failing for the same reason that the following code segfaults 
on Linux (Debian, with R 3.4.0):

test <- inline::cfunction(language='C',
     otherdefs='void *xmalloc(size_t); void *xrealloc(void *, size_t);',
     body = 'void *ptr = xmalloc(256); xrealloc(ptr, 0); return 
R_NilValue;')
test()
## xrealloc: out of virtual memory

It seems that the R xrealloc doesn't like being given a size of 0, even 
though this behavior is well-defined for realloc (it should free the 
memory). Based on my failing CRAN tests, it looks like this is a 
Linux-specific issue.

Is there a way to modify my Makevars to force the linker to choose my 
version of xrealloc for my package-specific code? My current Makevars 
are at https://github.com/patperry/r-corpus/blob/master/src/Makevars

Thanks in advance for any help.


Patrick


	[[alternative HTML version deleted]]



More information about the R-devel mailing list