Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
421 views
in Technique[技术] by (71.8m points)

node.js - Why does nodemon/grunt auto reload causes continous heapdumps to be written to file?

I'm using the heapdump module to investigate memory leaks in my node.js app. In development I'm using Grunt and nodemon to auto build (typescript => js) and reload the app. I've found that even including the heapdump module with var heapdump = require('heapdump'); causes heapdump files to continuously be written to the project root directory after I change a file. Here's an example of the filenames:

ls -1 heapdump-*
heapdump-16798025.709229.heapsnapshot
heapdump-16804706.868278.heapsnapshot
heapdump-16810376.817875.heapsnapshot
heapdump-16817216.844404.heapsnapshot
heapdump-16821854.974467.heapsnapshot
heapdump-16827753.236280.heapsnapshot
heapdump-16832525.325178.heapsnapshot
heapdump-16837019.589238.heapsnapshot
heapdump-16841498.201869.heapsnapshot

What's causing this and how can i prevent it from happening?

EDIT: I created a nodemon.json file with the following:

{
  "verbose": true,
  "ignore": ["./*.heapsnaphot", "data/*"]
}

But still doesn't stop the problem. The nodemon log looks like this:

[nodemon] files triggering change check: www.js
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] www.js

[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: heapdump-15717150.745801.heapsnapshot
[nodemon] matched rule: **/*.*

As you can see the ignore rule isn't working on the heapdump files.

question from:https://stackoverflow.com/questions/65932557/why-does-nodemon-grunt-auto-reload-causes-continous-heapdumps-to-be-written-to-f

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...