Investigate high memory usage for tests in CI

XMLWordPrintableJSON

    • Type: Investigation
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Developer Tools

      From mongosh, test_vscode, we noticed potentially high usage of memory in VSCode tests: https://github.com/mongodb-js/mongosh/pull/2239

      It might be worth investigating why this is happening in case there are some memory leaks either in our CI / test setup or even the extension itself.

      I briefly gave this a go and used this MemoryUsageReporter with Mocha and did not see any tests > 10mb usage so perhaps a lot of it comes from setup or other factors. It may also just be the memory associated with spinning up electron.

      class MemoryUsageReporter extends Mocha.reporters.Base {  constructor(runner) {    super(runner);
          runner.on('test', (test) => {      test.memoryUsageBefore = process.memoryUsage().heapUsed;    });
          runner.on('test end', (test) => {      const memoryUsageAfter = process.memoryUsage().heapUsed;      const memoryUsageDiff =        (memoryUsageAfter - test.memoryUsageBefore) / (1024 * 1024);
            if (memoryUsageDiff > 1000) {        console.log('==== HEAVY TEST ====');      }
            console.log(        `Memory usage for test "${test.title}": ${memoryUsageDiff.toFixed(          2        )} MB`      );    });  }} 

              Assignee:
              Unassigned
              Reporter:
              Gagik Amaryan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: