Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Re-inject native Node modules #4970
This PR improves the sandboxing for native modules. Every time a native require is detected, Jest will:
This kills all memory leaks related to
It also makes the
Yes, I just debugged it. What is happening is that
To be precise, what fails is the execution of any
This is great work, I'm so excited for better sandboxing and fewer memory leaks in Jest. Can you work on some of the inline comments that I left?
Before merging this, here are some more high-level questions that would be great to answer:
- Can you show results of
--logHeapUsage -ibefore and after this change?
- How does this affect performance of Jest?
- Can we reduce this to only two module registries (internal and user) vs. three?
Added a new commit (also rebased over master); modifying where memory is measured. Memory consumption went down from 156 to 143 MB (i.e ~10% less memory
However, the memory still grows within the first tests, up until it stabilizes around 143 MB. Some simple snapshots between tests (running with
referenced this pull request
Nov 28, 2017
@@ Coverage Diff @@ ## master #4970 +/- ## ========================================== + Coverage 60.25% 60.27% +0.01% ========================================== Files 198 198 Lines 6623 6659 +36 Branches 4 3 -1 ========================================== + Hits 3991 4014 +23 - Misses 2632 2645 +13