"Ran out of memory allocating x bytes with alignment 0" Error when saving-loading

I think I fixed the problem.

Error log was saying that my program was crashing at this line:



 CharDetails.SpecialID = SpecialID; 

However, it was crashing 1 line above, which is


 CharDetails.FaceDetails = MorphManager->FaceDetails;  
 

I was trying to forcing garbage collector to see if it was garbage collected and became null or not. Forcing garbage collector has no effect on the problem. However, I realized that I only experience the problem after waiting a while. Probably GC is collecting it somehow? Im not sure.

I solved the problem by marking these variables with UPROPERTY(). I also marked SpecialID as UPROPERTY() aswell.



    UPROPERTY()
    FHumanCharacterDetails CharDetails;
    UPROPERTY()
    UMorphManager* MorphManager;
    UPROPERTY()
    UEquipmentManager* EquipmentManager;
    UPROPERTY()
    TMap<EEquipmentSlots, int32> EquippedItems;