Skip to content

Run garbage collector on AfterLastTestMethodFinished #5843

@rr-it

Description

@rr-it

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),
);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/test-runnerCLI test runnertype/enhancementA new idea that should be implementedtype/performanceIssues related to resource consumption (time and memory)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions