Deleting TArray of pointers

Hi guys,

my latest project includes a big array of FVectors with boolean value. I got lost in the UObject and Garbage collector though. I have created an UStruct FCubeP (CubePoint)

USTRUCT()
struct FCubeP
{
	GENERATED_USTRUCT_BODY()

		UPROPERTY()
		bool isActive;

		UPROPERTY()
		FVector location;

	//base constructor
		FCubeP()
	{
	}
};

Then in my Actor I am creating dummy array of many points and then in BeginDestroy() I try to mark it for GC to get it. Aka, setting each pointer to nullptr. I have read that this should be the proper way to mark UStruct for GC.

ALeakTestActor::ALeakTestActor()
{
	PrimaryActorTick.bCanEverTick = false;
	
	// IN HEADER FILE : TArray<FCubeP *> list;
	FCubeP * tempPoint = new FCubeP();
	list.Add(tempPoint);
	for (int32 b = 0; b < 99999999; b++) {
		list.Add(new FCubeP());
	}
}


void ALeakTestActor::BeginDestroy()
{
	for (int32 b = 0; b < list.Num(); b++) {
		list[b] = nullptr;   
	}
}

But it crashes or still leaves memory allocated. Can anyone please help me how to store large number of pointers to my own object and dispose it correctly? I know I can do it manually (pure c++) but I am trying to learn the Garbage collector way.

Kind regards,
Crispy

Could you post the log?

Sorry for bumping this but I would love an answer to this too.

I have a TArray that holds pointers to a custom data class I created to index some instanced tiles. Deleting some pointers at runtime is good, but when I want to delete the pointer array when the window is closed on EndPlay(), Unreal crashes. Is there a proper way to do this?

I get:

Access violation - code c0000005 (first/second chance not available)

UE4Editor_Core!rml::internal::Block::findObjectSize()
UE4Editor_Core!FMallocTBB::Free() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\private\hal\malloctbb.cpp:109]
UE4Editor_Core!FMemory::Free() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\public\hal\fmemory.inl:49]
UE4Editor_Athena_5349!AMap_Controller::EndPlay() [c:\users\omarf\desktop\athena\source\athena\maps\map_controller.cpp:76]

Thanks for the help.