Skip to content

deleting javascript objects#738

Merged
K20shores merged 2 commits intomainfrom
deletion
Jan 16, 2026
Merged

deleting javascript objects#738
K20shores merged 2 commits intomainfrom
deletion

Conversation

@K20shores
Copy link
Copy Markdown
Collaborator

Javascript objects must manually be deleted. This adds that to our classes and tests

@github-actions
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds manual memory management for JavaScript objects created via Emscripten bindings. According to Emscripten documentation, JavaScript wrappers for C++ objects must be manually deleted to prevent memory leaks.

Changes:

  • Added delete() methods to MICM and State classes to clean up native WASM objects
  • Updated all test cases in micm.test.js to call delete() on MICM and State instances after use

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
javascript/micm/micm.js Added delete() method to clean up _nativeMICM object
javascript/micm/state.js Added delete() method to clean up _nativeState object
javascript/tests/unit/micm.test.js Added cleanup calls for all MICM and State instances created in tests
Comments suppressed due to low confidence (2)

javascript/micm/state.js:48

  • The VectorConditions object created here is never deleted, causing a memory leak. According to Emscripten documentation, all native objects must be manually deleted. Consider calling vec.delete() after line 78 where it's used.
		const vec = new backend.VectorConditions();

javascript/micm/state.js:74

  • The Condition objects created in this loop are never deleted, causing a memory leak. Each Condition object should be deleted after being added to the vector, or they should be deleted when the VectorConditions is deleted (if ownership is transferred).
			const cond = new backend.Condition(T, P, rho);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.92%. Comparing base (3d25c12) to head (eb9280b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #738      +/-   ##
==========================================
- Coverage   75.80%   74.92%   -0.89%     
==========================================
  Files         108      109       +1     
  Lines        7974     8080     +106     
==========================================
+ Hits         6045     6054       +9     
- Misses       1929     2026      +97     
Flag Coverage Δ
cpp_fortran 68.49% <ø> (ø)
javascript 92.27% <100.00%> (+0.05%) ⬆️
python 79.46% <ø> (-3.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@K20shores K20shores merged commit e1bbd91 into main Jan 16, 2026
44 of 45 checks passed
@K20shores K20shores deleted the deletion branch January 16, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants