Skip to content

Use enif_alloc/enif_free for std::vector allocations#79

Open
NelsonVides wants to merge 1 commit intomasterfrom
vector-allocator
Open

Use enif_alloc/enif_free for std::vector allocations#79
NelsonVides wants to merge 1 commit intomasterfrom
vector-allocator

Conversation

@NelsonVides
Copy link
Copy Markdown
Collaborator

std::vector's default std::allocator uses malloc/free, which bypasses BEAM memory bookkeeping. Introduce a custom enif_allocator<T> that delegates to enif_alloc/enif_free so all NIF heap usage is visible to erlang:memory() and crash dumps.

Not sure who's the ideal reviewer for this so tagging a couple of guys 😉

std::vector's default std::allocator uses malloc/free, which bypasses
BEAM memory bookkeeping. Introduce a custom enif_allocator<T> that
delegates to enif_alloc/enif_free so all NIF heap usage is visible to
erlang:memory() and crash dumps.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.99%. Comparing base (ad80c56) to head (744ff96).

Files with missing lines Patch % Lines
c_src/exml.cpp 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
- Coverage   74.01%   73.99%   -0.02%     
==========================================
  Files           7        7              
  Lines        1189     1196       +7     
  Branches      169      171       +2     
==========================================
+ Hits          880      885       +5     
- Misses        309      311       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants