Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix severe node performance issue due to buffer allocation bug, fix undefined behavior which breaks node > 18.7.0 #82

Open
wants to merge 3 commits into
base: latest
Choose a base branch
from

Commits on Sep 19, 2023

  1. Change to using std::min() when allocating Buffers on the C++ side. T…

    …his will result in Buffers being allocated to the size requested up to kMaxLength (0x3fffffff) instead of the current behavior of always allocating kMaxLength. Since these buffers are allocated in the node external memory (limited to 64M) the old behavior would very quickly cause massive GC pressure as the GC is triggered on each new Buffer allocation once the node external memory limit is reached. It appears the old behavior was not intentional and should have always been std::min(). This should fix node-ffi-napi#72
    doggkruse authored and afreer committed Sep 19, 2023
    Configuration menu
    Copy the full SHA
    03254fe View commit details
    Browse the repository at this point in the history
  2. Handle case where the previously allocated array buffer is shorter th…

    …an the current request. This is likely what drove the problematic max size allocation
    doggkruse authored and afreer committed Sep 19, 2023
    Configuration menu
    Copy the full SHA
    f8a991c View commit details
    Browse the repository at this point in the history
  3. src/binding.cc:WrapPointer(): Fix bug in Node.js > 18.7.0, ensure len…

    …gth is non-zero for non-null pointers.
    afreer committed Sep 19, 2023
    Configuration menu
    Copy the full SHA
    9eee8df View commit details
    Browse the repository at this point in the history