Memory Leak With TArray of Struct

If i use this struct ( without USTRUCT() cause i don’t need it to be in blueprint ) :

struct FVisibleArea
{
	int32 VEmitType;
	TSet<int32> area;
	FVisibleArea(int32 NewVEmitType)
	{
		VEmitType = NewVEmitType;
	}
};

I Store them in This Array:

TArray<FVisibleArea> VisibleAreas_T1;

Adding them by:

    VisibleAreas_T1.Add(FVisibleArea(VEmitType));

And when i want to remove area i just use This:

VisibleAreas_T1.RemoveAtSwap(VEmitID);

Will it cause Memory Leak? Cause I Don’t destroy structure and TSet in it Manually.

This won’t cause a memory leak, your structs and the TSet inside it will be automatically destroyed soon after VisibleAreas_T1 gets out of scope. You don’t have to destroy them manually because you’re not allocating memory manually (i.e. with the new operator).

The story would be different if there were pointers involved. In that case, if you have a pointer to a UObject you should store it in a variable marked UPROPERTY, and to support that, your class must be a UCLASS or USTRUCT. Not doing so would not give you a risk of memory leak, but rather that the object could be garbage collected too early by UE’s built-in garbage collection which does reference counting via UPROPERTY marked variables.

If you create a non UObject pointer, its your own responsibility to delete it eventually.