Any allocations in FRunnableThread::Run never get freed

When spawning a FRunnableThread and running the following:

This does leak:

uint32 LoaderWorker::Run() {
	TArray<uint8>* vec = new TArray<uint8>;

	for (int i = 0; i < 10000000; i++) {
		vec->Add(i % 255);
	}

	delete vec;
}

This does not leak:

uint32 LoaderWorker::Run() {
	TArray<uint8>* vec = new TArray<uint8>;

	vec->Reserve(10000000);

	for (int i = 0; i < 10000000; i++) {
		vec->Add(i % 255);
	}

	delete vec;
}

What is going on

Thanks! will do.

Hi @Mwni,
As far as I’m aware this doesn’t seem to be normal behavior since reserving memory for an array shouldn’t impact whether or not its deallocated. You can try reporting this issue using the Bug Submission Form, although it would be great if you could let us know what you find out. Cheers.