On 4/7/22 08:59, Adrian Du?a wrote:> Dear R devs,
>
> I ran into a C level problem that hopefully is a quick fix to a trained
eye.
>
> Not sure if I am able to produce a minimal reproducible example, but
> suppose a (test) package passes all the local tests, passes the R CMD check
> and also passes the tests on both rhub and
https://win-builder.r-project.org
>
> The test GitHub repo is here:
> https://github.com/dusadrian/QCAtest
>
> As per the latest CRAN recommendation, I need to replace calloc() and
> free() with R's Calloc() and Free(). In the above repo, the latest
commit
> does not pass the tests any longer, and the absolute single difference is
> using the recommended commands in the file:
> https://github.com/dusadrian/QCAtest/blob/main/src/CCubes.c
>
> The previous initial commit of this file (which has no problems) is here:
>
https://github.com/dusadrian/QCAtest/blob/5fb13f44457a2071b322ad42ab579f3547d1c551/src/CCubes.c
>
> There must be something obvious I'm doing wrong, perhaps a header
missing
> or not in the right place, but it just escapes me.
> I've tried both Calloc() and R_Calloc(), both versions result in the
same
> errors.
And what are the errors you run into? On which platforms, under what
circumstances, etc? It would be much easier to give advice knowing that.
In principle, one issue you may run into when switching allocators is
that you accidentally end up freeing by a different allocator from the
one used to allocate it. It is common on Windows but can in principle
happen elsewhere as well.
Also by a slightly different heap layout or different allocator
implementation you may wake up bugs in the program not seen previously
(use after free, invalid memory accesses, etc)
Tomas
>
> Many thanks in advance for any hint,
> Adrian
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel