Skip to content

Segmentation fault in dfloor benchmark at large input size (length =1,000,000) #7224

Closed
@Deepak91168

Description

@Deepak91168
Contributor

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

stdlib-bot commented on Jun 5, 2025

@stdlib-bot
Contributor

👋 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

Deepak91168 commented on Jun 5, 2025

@Deepak91168
ContributorAuthor
kgryte

kgryte commented on Jun 6, 2025

@kgryte
Member

This is a duplicate of #369.

added
DuplicateThis issue or pull request already exists.
on Jun 6, 2025
added a commit that references this issue on Jun 11, 2025
abc78da
navyansh007

navyansh007 commented on Jun 11, 2025

@navyansh007

I have raised a PR #7317 that resolves this issue.

Neerajpathak07

Neerajpathak07 commented on Jun 11, 2025

@Neerajpathak07
Member

@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

Deepak91168 commented on Jun 12, 2025

@Deepak91168
ContributorAuthor

@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!!

Ok! I will make sure for any future work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateThis issue or pull request already exists.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @kgryte@Deepak91168@stdlib-bot@navyansh007@Neerajpathak07

      Issue actions

        Segmentation fault in dfloor benchmark at large input size (length =1,000,000) · Issue #7224 · stdlib-js/stdlib