-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose and run GC for nodejs to avoid memory intensive actions to run…
… in memory limit run garbage collector automatically
- Loading branch information
1 parent
f557a82
commit 9eb7fde
Showing
5 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,4 +75,4 @@ xmlhttprequest@1.8.0 \ | |
yauzl@2.7.0 | ||
|
||
# See app.js | ||
CMD node app.js | ||
CMD node --expose-gc app.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,4 +53,4 @@ xmlhttprequest@1.7.0 \ | |
yauzl@2.3.1 | ||
|
||
# See app.js | ||
CMD node app.js | ||
CMD node --expose-gc app.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function eat(memoryMB) { | ||
var bytes = 1*1024*1024*memoryMB; | ||
var buffer = new Buffer.alloc(bytes, 'a'); | ||
buffer = null; | ||
console.log('done.'); | ||
} | ||
|
||
function main(msg) { | ||
console.log('helloEatMemory', 'memory ' + msg.payload + 'MB'); | ||
eat(msg.payload); | ||
return {msg: 'OK, buffer of size ' + msg.payload + ' MB has been filled.'}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters