Skip to content

Commit

Permalink
Node 10 Support (#27)
Browse files Browse the repository at this point in the history
* chore: drop support for node 6

* fix: installation on node 10

This PR swaps the original memwatch-next with another fork to support node 10+.

* fix(test): make more iterations to detect leakage

The original setting for memory pressure is too subtle to be detected. This
commit changes the number of test iteration to a much higher number so that
leakage can be more easily detected.
  • Loading branch information
alvis authored and andywer committed Jun 4, 2018
1 parent 5ee8c95 commit f397a9c
Show file tree
Hide file tree
Showing 6 changed files with 629 additions and 121 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ addons:
- g++-4.8
node_js:
- node # Latest
- 9.0
- 8.11 # LTS
- 7.0
- 6.0
before_install:
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then export CXX=g++-4.8; fi
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Test for memory leaks. Will return a rejecting promise when a leak is recognized
### Result object

Properties:
* `heapDiffs` - An array of heap diffs as created by `memwatch-next`
* `heapDiffs` - An array of heap diffs as created by `node-memwatch`
* `iterations` - The number of iterator runs per heap diff
* `gcollections` - The number of garbage collections / heap diffs performed

Expand Down Expand Up @@ -160,7 +160,7 @@ Will make the library write a detailed heap diff JSON to the file system. Make s

## Under the Hood

Leakage uses `memwatch-next` to trigger the garbage collector and create heap diffs.
Leakage uses `node-memwatch` to trigger the garbage collector and create heap diffs.

You just specify an iterator function. It will be run 30 times by default then a garbage collection will be performed and a heap snapshot will be made. This process is iterated 6 times by default to collect several heap diffs, since especially in async tests there is always a bit of background noise.

Expand All @@ -169,7 +169,7 @@ If the heap size increased over more than `[heapDiffCount * 2 / 3]` subsequent g

## Travis CI

You might want your leakage tests to be run by your CI service. There is an issue with Travis CI's linux containers, `g++` and a transitive dependency of `memwatch-next` ([nan](https://www.npmjs.com/package/nan)).
You might want your leakage tests to be run by your CI service. There is an issue with Travis CI's linux containers, `g++` and a transitive dependency of `node-memwatch` ([nan](https://www.npmjs.com/package/nan)).

Fortunately there is a fix: You need to install and use version `4.8` of `g++` in order to compile the dependency.

Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

const fs = require('fs')
const memwatch = require('memwatch-next')
const memwatch = require('@airbnb/node-memwatch')
const minimist = require('minimist')
const path = require('path')
const { createResult } = require('./result')
Expand Down
Loading

0 comments on commit f397a9c

Please sign in to comment.