microsoft/TypeScript-Compiler-Notes

Memory leakage occurs in the getTypeAtLocation method in the latest version.

Closed this issue · 0 comments

Invoke the getTypeAtLocation method one million times cyclically. Before and after the loop, perform GC and print heapUsed. The memory usage increases by about 150 MB.
global.gc(); const m = process.memoryUsage(); console.log(before,${m.heapUsed/1024/1024}`);

for (let a=1;a <= 1000000;a++) {
typeChecker.getTypeAtLocation(node.typeName);
}

global.gc();
const m1 = process.memoryUsage();
console.log(after,${m1.heapUsed/1024/1024});`