Garbage collection in background thread

I am curious if this is correct practice:

  1. I create UObject* in background thread and then add it to root at the begin of my function:
UCell* StartCell = NewObject<UCell>();
StartCell->AddToRoot();
StartCell->Initialize(Start, nullptr, 0.f, 0.f);
  1. As the function runs, i create more objects like this:
UCell* Neighbour = NewObject<UCell>(Cell);

where “Cell” is the previous element in chain (StartCell is the first)

  1. At the end of the function:
StartCell->RemoveFromRoot();

I am curious if this is the correct, and will the other cells get picked up by the garbage collector eventually

i wonder if at this point it would be safer to remove inheritance from UObject and just manually manage memory