Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run garbage collector on AfterLastTestMethodFinished #5843

Closed
rr-it opened this issue May 27, 2024 · 2 comments
Closed

Run garbage collector on AfterLastTestMethodFinished #5843

rr-it opened this issue May 27, 2024 · 2 comments
Labels
feature/test-runner CLI test runner type/enhancement A new idea that should be implemented type/performance Issues related to resource consumption (time and memory)

Comments

@rr-it
Copy link

rr-it commented May 27, 2024

The garbage collector can be already configured to run after every X (default: 100) Tests.

I realized most memory can be freed up when a test-case with all its tests is finished:

May we add a configuration option to also trigger the garbage collector on event AfterLastTestMethodFinished?

E.g. trigger a new function GarbageCollectionHandler::lastTestMethodFinished

    public function lastTestMethodFinished(): void
    {
            gc_collect_cycles();

            $this->facade->emitter()->testRunnerTriggeredGarbageCollection();

            $this->tests = 0;
    }

Current triggers:

/**
* @throws EventFacadeIsSealedException
* @throws UnknownSubscriberTypeException
*/
private function registerSubscribers(): void
{
$this->facade->registerSubscribers(
new ExecutionStartedSubscriber($this),
new ExecutionFinishedSubscriber($this),
new TestFinishedSubscriber($this),
);
}

@rr-it rr-it added the type/enhancement A new idea that should be implemented label May 27, 2024
@sebastianbergmann sebastianbergmann added feature/test-runner CLI test runner type/performance Issues related to resource consumption (time and memory) labels May 27, 2024
@rr-it
Copy link
Author

rr-it commented May 27, 2024

This is related to #4705

If the properties of a test-object are unset in tearDown then memory must still be cleaned up via garbage collector eg. in tearDownAfterClass method = event AfterLastTestMethodFinished.

@rr-it
Copy link
Author

rr-it commented Jun 17, 2024

This is not necessary anymore as the memory issue is resolved by:
#5861

@rr-it rr-it closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/enhancement A new idea that should be implemented type/performance Issues related to resource consumption (time and memory)
Projects
None yet
Development

No branches or pull requests

2 participants