source: frontend/node_modules/jest-leak-detector/README.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 694 bytes
Line 
1# jest-leak-detector
2
3Module for verifying whether an object has been garbage collected or not.
4
5Internally creates a weak reference to the object, and forces garbage collection to happen. If the reference is gone, it meant no one else was pointing to the object.
6
7## Example
8
9```javascript
10(async function () {
11 let reference = {};
12 let isLeaking;
13
14 const detector = new LeakDetector(reference);
15
16 // Reference is held in memory.
17 isLeaking = await detector.isLeaking();
18 console.log(isLeaking); // true
19
20 // We destroy the only reference to the object.
21 reference = null;
22
23 // Reference is gone.
24 isLeaking = await detector.isLeaking();
25 console.log(isLeaking); // false
26})();
27```
Note: See TracBrowser for help on using the repository browser.