On Wed, 17 Jan 2024, Hugh Parsonage wrote:

My package grattan fails the Intel[1] check with

 Error: segfault from C stack overflow

I am unable to immediately see where in the test suite this error has
occurred.  I seek advice on how to fix this error.  The only hunch I
have is that the package uses C code and includes structs with arrays
on the stack, which perhaps are excessive for the Intel check machine,
but am far from confident that's the issue.  The repository is at
<https://github.com/HughParsonage/grattan/>

Two possibilities to look into:

* your structures on the stack are large. Don't do this ! Your code might run faster and would be easier to debug if you use regular memory allocation instead. Since R does fair number of memory allocation calls itself, the extra overhead from your calls will not be that noticeable.

* your stuctures are small, but you have a recursive function that is called too often. In this case, the solution is to reimplement the recurrence without doing function calls (using a loop, for example). Some recurrences can be implemented without using any accumulating state. Others need it and you can use heap memory for that.

best

Vladimir Dergachev


[1]https://www.stats.ox.ac.uk/pub/bdr/Intel/grattan.out

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to