memory inspector
1.0.0

memory inspector Web アプリケーションのメモリ使用量/動作を監視します。現在、DevTools プロトコルを介してヘッドレス Chrome または Chromium を制御する API である Puppeteer 上で実行されます。
yarn add --dev memory-inspector const memoryInspector = require ( 'memory-inspector' )
const config = {
url : 'http://localhost:3000' ,
maxMemoryLimit : 20 * 1048576 , // should not pass of 20MB
maxMemoryPercentThreshold : 90 , // should not pass 90% of total memory
}
memoryInspector ( config ) . then ( ( info ) => console . log ( info ) )
/*
{ "exceededMemoryMaximum": 1528951424,
"exceededMemoryUsagePercent": true,
"jsHeapSizeLimit": "2.19 GB",
"memoryUsagePercent": 21900000,
"totalJSHeapSize": "1.53 GB",
"usedJSHeapSize": "1.53 GB" }
*/ const memoryInspector = require ( 'memory-inspector' )
const config = {
url : 'http://127.0.0.1:8080' ,
delay : 300 ,
formatted : false , // default is true
maxMemoryLimit : 20 * 1048576 , // should not pass of 20MB
maxMemoryPercentThreshold : 90 , // should not pass 90% of total memory
waitUntil : [ 'domContentLoaded' ] , // wait for browser events
}
memoryInspector ( config ) . then ( ( info ) => console . log ( info ) )
/*
{ usedJSHeapSize: 10000000,
totalJSHeapSize: 11900000,
jsHeapSizeLimit: 2190000000,
memoryUsagePercent: 438000000,
exceededMemoryMaximum: -10971520,
exceededMemoryUsagePercent: false }
*/ <string>ページの移動先の URL。 URL にはスキームが含まれている必要があります (例: https://
<boolean>バイトを2190000000 ~ 2.19 GBのようなサイズにフォーマットするかどうかを定義します。デフォルトではtrueです。
<number>指定されたミリ秒単位でレポートの速度を低下させます。
<number>アプリケーションが使用できる最大メモリ制限を設定します。これは、 exceededMemoryMaximumレポートに反映されます。
<number>アプリケーションの最大メモリパーセントしきい値を設定します。これは、 exceededMemoryUsagePercentレポートに反映されます。
<string|array<string>>ナビゲーションが成功したとみなされるタイミング。イベント文字列の配列を指定すると、すべてのイベントが発生した後にナビゲーションが成功したとみなされます。
A Puppeteer に感謝します。
Raphael Amorim 製、MIT ライセンス