lifecycle.ts ×5

Frontier kind: Code frontier

unlabeled · c_842fa471c31a

2 tests · 4383 LOC · 21 files · introduces 0 tests · 64 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges64 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
602 ranges4383 lines · 21 files · Browse complete extent
All tests (intent)
2 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Introduced files, introduced tests, and structurally relevant concept specializationlifecycle.test|title=No Leakage Utilities throwIfDisposablesAreLeaked throws if an event subscription is not cleaned up|occurrence=1 · 0 introduced LOClifecycle.test|title=No …lifecycle.test|title=No Leakage Utilities throwIfDisposablesAreLeaked throws if a disposable is not disposed|occurrence=1 · 0 introduced LOClifecycle.test|title=No …map.ts ×1 · 1 introduced LOCmap.ts ×1utils.ts ×3 · 10 introduced LOCutils.ts ×3lifecycle.ts ×2 · 7 introduced LOClifecycle.ts ×2map.ts ×2 · 3 introduced LOCmap.ts ×2map.ts ×1 · 9 introduced LOCmap.ts ×1map.ts ×1 · 2 introduced LOCmap.ts ×1event.ts ×93 · 864 introduced LOCevent.ts ×93linkedList.ts ×13 · 44 introduced LOClinkedList.ts ×13lifecycle.ts ×1 · 6 introduced LOClifecycle.ts ×1collections.ts ×1 · 11 introduced LOCcollections.ts ×1lifecycle.ts ×1 · 7 introduced LOClifecycle.ts ×1lifecycle.ts ×6 · 16 introduced LOClifecycle.ts ×6arrays.ts ×1 · 2 introduced LOCarrays.ts ×1lifecycle.ts ×1 · 3 introduced LOClifecycle.ts ×1map.ts ×97 · 3334 introduced LOCmap.ts ×97src/vs/base/common/arrays.ts · 949 LOCcommon/arrays.tssrc/vs/base/common/arraysFind.ts · 226 LOCcommon/arraysFind.tssrc/vs/base/common/assert.ts · 91 LOCcommon/assert.tssrc/vs/base/common/charCode.ts · 450 LOCcommon/charCode.tssrc/vs/base/common/collections.ts · 176 LOCcommon/collections.tssrc/vs/base/common/errors.ts · 357 LOCcommon/errors.tssrc/vs/base/common/event.ts · 1964 LOCcommon/event.tssrc/vs/base/common/functional.ts · 32 LOCcommon/functional.tssrc/vs/base/common/iterator.ts · 194 LOCcommon/iterator.tssrc/vs/base/common/lifecycle.ts · 974 LOCcommon/lifecycle.tssrc/vs/base/common/linkedList.ts · 151 LOCcommon/linkedList.tssrc/vs/base/common/map.ts · 1016 LOCcommon/map.tssrc/vs/base/common/marshallingIds.ts · 33 LOCcommon/marshallingIds.tssrc/vs/base/common/path.ts · 1589 LOCcommon/path.tssrc/vs/base/common/platform.ts · 281 LOCcommon/platform.tssrc/vs/base/common/process.ts · 76 LOCcommon/process.tssrc/vs/base/common/stopwatch.ts · 41 LOCcommon/stopwatch.tssrc/vs/base/common/types.ts · 410 LOCcommon/types.tssrc/vs/base/common/uri.ts · 754 LOCcommon/uri.tssrc/vs/base/test/common/utils.ts · 107 LOCcommon/utils.tssrc/vs/nls.ts · 244 LOCvs/nls.tslifecycle.test|title=No Leakage Utilities throwIfDisposablesAreLeaked throws if a disposable is not disposed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/lifecycle.test|title=No Leakage Utilities throwIfDisposablesAreLeaked throws if a disposable is not disposed|occurrence=1lifecycle.test|title=No …lifecycle.test|title=No Leakage Utilities throwIfDisposablesAreLeaked throws if an event subscription is not cleaned up|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/lifecycle.test|title=No Leakage Utilities throwIfDisposablesAreLeaked throws if an event subscription is not cleaned up|occurrence=1lifecycle.test|title=No …Focused concept · lifecycle.ts ×5 · 64 introduced LOClifecycle.ts ×5

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 64 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/common/lifecycle.ts 61 introduced LOC · 5 ranges

Open complete file

152 return;
153 }
154 > const leakingObjsSet = new Set(leakingObjects.map(o => o.value)); lifecycle.ts
155 >
156 > // Remove all objects that are a child of other leaking objects. Assumes there are no cycles.
157 > uncoveredLeakingObjs = leakingObjects.filter(l => {
158 > return !(l.parent && leakingObjsSet.has(l.parent));
159 > });
160 >
161 > if (uncoveredLeakingObjs.length === 0) {
162 throw new Error('There are cyclic diposable chains!');
163 }
164 }
165 > lifecycle.ts
166 > if (!uncoveredLeakingObjs) {
167 return undefined;
168 }
169 > lifecycle.ts
170 > function getStackTracePath(leaking: DisposableInfo): string[] {
171 > function removePrefix(array: string[], linesToRemove: (string | RegExp)[]) {
172 > while (array.length > 0 && linesToRemove.some(regexp => typeof regexp === 'string' ? regexp === array[0] : array[0].match(regexp))) {
173 > array.shift();
174 > }
175 > }
176 >
177 > const lines = leaking.source!.split('\n').map(p => p.trim().replace('at ', '')).filter(l => l !== '');
178 > removePrefix(lines, ['Error', /^trackDisposable \(.*\)$/, /^DisposableTracker.trackDisposable \(.*\)$/]);
179 > return lines.reverse();
180 > }
181 >
182 > const stackTraceStarts = new SetMap<string, DisposableInfo>();
183 > for (const leaking of uncoveredLeakingObjs) {
184 > const stackTracePath = getStackTracePath(leaking);
185 > for (let i = 0; i <= stackTracePath.length; i++) {
186 > stackTraceStarts.add(stackTracePath.slice(0, i).join('\n'), leaking);
187 > }
188 > }
189 >
190 > // Put earlier leaks first
191 > uncoveredLeakingObjs.sort(compareBy(l => l.idx, numberComparator));
192 >
193 > let message = '';
194 >
195 > let i = 0;
196 > for (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {
197 > i++;
198 > const stackTracePath = getStackTracePath(leaking);
199 > const stackTraceFormattedLines = [];
200 >
201 > for (let i = 0; i < stackTracePath.length; i++) {
202 > let line = stackTracePath[i];
203 > const starts = stackTraceStarts.get(stackTracePath.slice(0, i + 1).join('\n'));
204 > line = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;
205 >
206 > const prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i).join('\n'));
207 > const continuations = groupBy([...prevStarts].map(d => getStackTracePath(d)[i]), v => v);
208 > delete continuations[stackTracePath[i]];
209 > for (const [cont, set] of Object.entries(continuations)) {
210 if (set) {
211 stackTraceFormattedLines.unshift(` - stacktraces of ${set.length} other leaks continue with ${cont}`);
212 }
213 }
214 > lifecycle.ts
215 > stackTraceFormattedLines.unshift(line);
216 > }
217 >
218 > message += `\n\n\n==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================\n${stackTraceFormattedLines.join('\n')}\n============================================================\n\n`;
219 > }
220 >
221 > if (uncoveredLeakingObjs.length > maxReported) {
222 message += `\n\n\n... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables\n\n`;
223 }
224 > lifecycle.ts
225 > return { leaks: uncoveredLeakingObjs, details: message };
226 }
227 }
src/vs/base/test/common/utils.ts 3 introduced LOC · 2 ranges

Open complete file

100 const result = tracker.computeLeakingDisposables();
101 if (result) {
102 > if (logToConsole) { utils.ts
103 console.error(result.details);
104 }
105 > throw new Error(`There are ${result.leaks.length} undisposed disposables!${result.details}`); utils.ts
106 > }
107 }