How to free memory of c++ WinRT value structs
问题 Do I have to, and how do I, free memory from a value struct created in a Windows Runtime Component that has been returned to a managed C# project? I declared the struct // Custom struct public value struct PlayerData { Platform::String^ Name; int Number; double ScoringAverage; }; like auto playerdata = PlayerData(); playerdata.Name = ref new String("Bla"); return playerdata; I'm new with freeing memory and haven't got a clue how and when to free this. Anyone? 回答1: When a value struct is