<div dir="ltr">Hi Dirk and Kevin,<div><br></div><div>Thank you for the replies. I was able to find a way to check my code using the build of R that CRAN used to point out these problems. I asked Uwe and he recommended I look into R-hub (which I had not encountered before) and found the <a href="https://builder.r-hub.io/advanced">package builder</a>, which includes the option to check on "Debian Linux, R-devel, GCC ASAN/UBSAN". I found that I had two issues: not correctly importing an R function into my Rcpp code, and using a lambda expression without importing C++11. I was using an Rcpp equivalent to base::order() as described in the answer to <a href="https://stackoverflow.com/questions/48118248/rcpp-rearrange-a-vector-in-an-order-of-another-vector">this SO question</a>. As a novice, I didn't know that this necessitated C++11. After adding the correct components to the source code (including adding C++11 to the system requirements in the Description), I received no errors when using the R-hub builder. So, I think I can say my problem has been solved. Sorry to have wasted others' time with this question, but hopefully it will be useful for posterity. </div><div><br></div><div>In short, I wasn't actually looking for help debugging the code, I just wanted to know a way to check whether my proposed edits had fixed the noted problems, and I found that solution in the R-hub builder.</div><div><br></div><div>Noah</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 16, 2020 at 1:27 PM Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi Noah,<br>
<br>
Thanks for posting here.  We'll try to help.<br>
<br>
On 15 November 2020 at 18:30, Noah Greifer wrote:<br>
| In searching for solutions to the problem of being able to check whether<br>
| the issue in my package remains, I came across this<br>
| <<a href="http://dirk.eddelbuettel.com/code/sanitizers.html" rel="noreferrer" target="_blank">http://dirk.eddelbuettel.com/code/sanitizers.html</a>> article posted by Dirk<br>
| ("sanitizers: Testing R packages for ASAN and UBSAN errors"). It seems like<br>
| this article is about using sanitizers, which helps you figure out if your<br>
| build of R is able to detect the memory allocation errors I was facing, but<br>
| doesn't give clear instructions on how to set up R to do this. As someone<br>
| for whom using Rcpp was my first use of programming outside R, the<br>
| instructions given in the article and in section 4.3 of Writing R<br>
| Extensions are completely foreign to me and seem to require a deep<br>
| knowledge of C++.<br>
<br>
[ Not quite: `sanitizers` is a package I wrote when facing such ASAN/UBSAN<br>
  report issues. I noticed that I at times had the additional difficulty of<br>
  being unable to reproduce such errors when they should have reproduced -- so<br>
  `sanitizers` "merely" regroups some of those errors to ensure the testing<br>
  procedure you use, these days mostly Docker containers or RHub services,<br>
  triggers them correctly and hence validates your setup. No more, really. ]<br>
<br>
| I'm wondering if someone can provide me with a clear procedure on how to<br>
| check if the memory allocation problem still remains in my package. Thank<br>
| you.<br>
<br>
This is is indeed advanced stuff, and sadly the CRAN maintainers sometimes<br>
fling it at us. As Kevin said, the best bet really is to distill it into as<br>
small an example as you can.  That is, in essence, what sanitizers does too<br>
if you look at its sources.  Once you have a small example, it usually<br>
becaome feasible / easier to find the solution to _not_ triggering the<br>
report.  Many of us have found that this is often an underlying programming<br>
bug in our packages, so as painful as it is when CRAN sticks the finger into<br>
these sores they usually do need fixing.<br>
<br>
Dirk<br>
<br>
-- <br>
<a href="https://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">https://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</blockquote></div>