node-opcua-leak-detector 2.169.0 → 2.172.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-leak-detector",
3
- "version": "2.169.0",
3
+ "version": "2.172.0",
4
4
  "description": "pure nodejs OPCUA SDK - module leak-detector",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -24,14 +24,14 @@
24
24
  "internet of things"
25
25
  ],
26
26
  "homepage": "http://node-opcua.github.io/",
27
- "gitHead": "82d570d3e95bea689cbbe30096279885c5282245",
27
+ "gitHead": "dfe9993a93b5c3897825e898b5f07b25952c7f45",
28
28
  "files": [
29
29
  "src"
30
30
  ],
31
31
  "dependencies": {
32
32
  "chalk": "4.1.2",
33
33
  "node-opcua-assert": "2.164.0",
34
- "node-opcua-object-registry": "2.169.0",
34
+ "node-opcua-object-registry": "2.172.0",
35
35
  "wtfnode": "^0.10.1"
36
36
  }
37
37
  }
@@ -16,7 +16,9 @@ let noGCexposed;
16
16
  */
17
17
  function forceGC() {
18
18
  if (global.gc) {
19
- global.gc();
19
+ // Major GC: thorough enough that callers don't need to invoke a separate
20
+ // global.gc(true) themselves before calling takeMemorySnapshot.
21
+ global.gc(true);
20
22
  noGCexposed = false;
21
23
  } else {
22
24
  if (noGCexposed === undefined) {
@@ -477,10 +477,8 @@ exports.installResourceLeakDetector = function(isGlobal, func) {
477
477
 
478
478
  });
479
479
  beforeEach(() => {
480
- // make sure we start with a garbage collected situation
481
- if (global.gc) {
482
- global.gc(true);
483
- }
480
+ // takeMemorySnapshot now does its own major GC; no need for an
481
+ // explicit gc(true) here. Saves one ~100ms major-GC stall per test.
484
482
  beforeSnapshot = takeMemorySnapshot();
485
483
  });
486
484
  if (func) {
@@ -506,10 +504,7 @@ exports.installResourceLeakDetector = function(isGlobal, func) {
506
504
 
507
505
  } else {
508
506
  beforeEach(function(/*this: Mocha.Test*/) {
509
-
510
- if (global.gc) {
511
- global.gc(true);
512
- }
507
+ // takeMemorySnapshot now does its own major GC; no separate gc(true) here.
513
508
  resourceLeakDetector.ctx = this.test.ctx;
514
509
  resourceLeakDetector.start();
515
510
  beforeSnapshot = takeMemorySnapshot();