Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Alex Ilich
Thanks for digging into this for me. If focal_val is 16, then this is an out of bounds error as the matrix is 16x16 and the maximum index can be 15. What I'm confused about is that focal_val comes from the data which has been transformed to be restricted to integers in the range of 0-15 (0 -

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Bill Dunlap
In this example vgdb shows that valgrind's first complaint is at (gdb) where 5 #0 0x1c1ada01 in C_make_glcm (x=..., n_levels=16, shift=..., na_opt=...) at glcm_cpp_functions.cpp:73 #1 0x1c1b2238 in C_glcm_textures_helper2 (x=..., w2=..., n_levels=16, shift=..., na_opt=..., ni=1,

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Bill Dunlap
Thanks, I hadn't noticed the --use-valgrind option to check. I often run R under valgrind with the command line: $ R --quiet --no-save --debugger=valgrind --debugger-args="--track-origins=yes --vgdb=full --vgdb-error=0" then in another window start a debugger process with $ gdb

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Dirk Eddelbuettel
On 13 December 2021 at 09:15, Bill Dunlap wrote: | I ran your example under valgrind on Linux (Ubuntu 20.04) Excellent call, as usual! Thanks for doing that. R actually makes is so easy to run with valgrind by calling R CMD check --use-valgrind somePkg_1.2-3.tar.gz that I started to add

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Bill Dunlap
I ran your example under valgrind on Linux (Ubuntu 20.04) and valgrind found some memory misuse: $ R --quiet --no-save --debugger=valgrind --debugger-args="--track-origins=yes" ==1533== Memcheck, a memory error detector ==1533== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Dirk Eddelbuettel
On 13 December 2021 at 11:14, Alexander Ilich wrote: | Hi, I'm upgrading one of my R packages to rely on the terra package instead | of the raster package for the handling of spatial raster data. Previously | when relying on the raster package I had to convert the data to a matrix | and send it

[Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Alexander Ilich
Hi, I'm upgrading one of my R packages to rely on the terra package instead of the raster package for the handling of spatial raster data. Previously when relying on the raster package I had to convert the data to a matrix and send it to C++ to loop through the cells manually, but with the new