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