Memory Leak When Call SceneCapture2D->CaptureScene()

Hello,
I am trying to read pixel from RenderTarget In SceneCaptureComponent2D. but when I call CaptureScene() in loop, I found that memory was occupied much a lot and never free.

My Code is:

    bool HasCapture = false;
	TArray<AActor*> Actors = GWorld->GetCurrentLevel()->Actors;
	TArray<ASceneCapture2D*> Captures;
	for (int i = 0; i < Actors.Num(); i++)
	{
		if (Actors[i]->IsValidLowLevel())
		{
			ASceneCapture2D* TempCapt = Cast<ASceneCapture2D>(Actors[i]);
			if (TempCapt != nullptr)
			{
				TempCapt->GetCaptureComponent2D()->bCaptureEveryFrame = false;
				TempCapt->GetCaptureComponent2D()->bCaptureOnMovement = false;
				Captures.Add(TempCapt);
				HasCapture = true;
			}
		}
	}
	if (!HasCapture) { return; }
	for (int32 i = 0; i < 1000; i++)
	{
		Captures[0]->GetCaptureComponent2D()->CaptureScene();
	}

When I Open Project, memory is:

After I Execute this Code, memory is:

I am not very familiar with C++, So I don’t know what went wrong.
And then I test code in Blueprint, It also happened.

blueprint:

So I will really appreciate it if someone told me how to deal with it.

I have tried to solve it by call this function per frame. And Memory seems to be free normally.

Code below:

void UTest::Tick(float DeltaTime)
{
	if (bStart)
	{
		for (int32 i = 0; i < 16; i++)
                {
                         Capture->GetCaptureComponent2D()->CaptureScene();
                }
	}
}

I tried it first on blueprint:

But I still don’t know what happened, can someone help me answer this question?

Hi, xyf2016

There is a UniformBufferPool in D3D11UniformBuffer.cpp, the UniformBuffers will be cached for several frames for safe reuse. Use “r.UniformBufferPooling 0” to disable it.

And there is a RenderQueryPool used in FRealtimeGPUProfiler, it will create a lot of RenderQueries during the loop and they are cached in the RenderQueryPool eventually. Use “r.GPUStatsEnabled 0” to disable it.