Won't this be garbage collected?

In this documentation Introduction to C++ Programming in UE4 | Unreal Engine Documentation

TMap part example, there is such a function, I am wondering, will this NewPiece will be garbage collected? Should we add UPROPERTY to protect it or not?

    void AddNewPiece(int32 PlayerId, EPieceType Type, FIntPoint Position)
    {
        FPiece NewPiece(PlayerId, Type, Position);
        Data.Add(Position, NewPiece);
    }

Only UObjects are part of garbage collection. This is a struct, and not even a pointer, so garbage collection is not relevant for it.

If NewPiece was a UObject, like

UPiece NewPiece(..)

Then it would be eligible for garbage collection, and in that case your map (Data) would need to be a UPROPERTY to prevent that.