ng-mocks icon indicating copy to clipboard operation
ng-mocks copied to clipboard

Potential memory leak?

Open satanTime opened this issue 1 year ago • 6 comments

Discussed in https://github.com/help-me-mom/ng-mocks/discussions/5435

Originally posted by maxs-rose April 12, 2023 After running ~2K tests the JS heap reaches 1GB of memory usage and no longer goes down.

image

There appears to be a lot of detached dom nodes handing around that seem to be related to ngMocksUniverse image

Most of the test are setup similarly to the following:

describe("some component", () => {
     ngMocks.faster();

     const someServiceMock = MockService(SomeService);

     beforeAll(() => {
         return MockBuilder(SomeComponent).mock(SomeService, someServiceMock);
     );
     
    it("should do something", () => {
         const component = MockRender(SomeComponent).point.componentInstance;
         
         component.foo();

         expect(someServiceMock.serviceMethod).toHaveBeenCalled();
    });

    /* some more it blocks */
);

We have tried removing ngMocks.faster but that doesn't seem to have any affect.

Is this behavior due to how we are using NgMocks?

satanTime avatar Apr 13 '23 08:04 satanTime