Description
Description
When running the benchmark ./benchmark.length.out
for @stdlib/math/strided/special/dfloor
on Fedora 42, the benchmark crashes with a segmentation fault at the largest tested length (1,000,000). Smaller lengths (up to 100,000) complete successfully without error.
To Reproduce this error:
cd /lib/node_modules/@stdlib/math/strided/special/dfloor/benchmark/c
Run:
./benchmark.length.out
Last few line of output:
---
iterations: 1000
elapsed: 0.221682072
rate: 4510.964700011
...
ok 14 benchmark finished
# c::dfloor:len=100000
---
iterations: 1000
elapsed: 0.184779882
rate: 5411.844551710
...
ok 15 benchmark finished
# c::dfloor:len=1000000
[1] 98416 segmentation fault (core dumped) ./benchmark.length.out
Reason for this issue non-dynamic implementation of:
/lib/node_modules/@stdlib/math/strided/special/dfloor/src/dfloor.c
Temporally can be fixed by increasing stack memory limit to unlimited using:
ulimit -s unlimited
Potential Permanent fix:
Dynamic implementation of dfloor.c
using malloc
Related issue
Any similar C file with non dynamic implementation can cause similar issue on other systems
Questions
Can we refactor all C files to use dynamic memory allocation wherever necessary to improve scalability and prevent issues similar segmentation faults?
Activity
stdlib-bot commentedon Jun 5, 2025
👋 Hi there! 👋
And thank you for opening your first issue! We will get back to you shortly. 🏃 💨
If you have any further questions while waiting for a response, please join our Gitter channel to chat with project maintainers and other community members.
Deepak91168 commentedon Jun 5, 2025
@Neerajpathak07
kgryte commentedon Jun 6, 2025
This is a duplicate of #369.
fix(math/strided/special/dfloor): replace stack allocation with dynam…
navyansh007 commentedon Jun 11, 2025
I have raised a PR #7317 that resolves this issue.
Neerajpathak07 commentedon Jun 11, 2025
@Deepak91168 A word of advice while creating a issue check if there is any issue or PR that aims to resolves it!!
It's a big help to the maintainers as they are loaded with work recently XD
Going ahead and closing this one!!
Deepak91168 commentedon Jun 12, 2025
Ok! I will make sure for any future work!