So previously I had an issue in C++ where using ‘new Something’ within a loop or function that is repeatedly called would cause a memory leak (as I never deleted/destroyed it after it was finished). I was wondering if the same thing happens in Unity with vectors.
As it is easier for me to define a new vector all at once using;
Vector3 myVector = new Vector3 (X, Y, Z);
In my code I have this within a for loop (as well as several other constantly called functions including update) and was wanting to check whether it will cause a memory leak, or if Unity automatically deletes the ‘new vector3…’ once its done (since it wasn’t an actual variable).
Also, within things like Visual Studio, I can easily tell iftheres a memory leak as when debugging the VS creates a new process for running the debugger, so I can easily see in task manager whether or not I have a memory leak. But in Unity I’m uncertain if this is also the case (IE if a leak happens, the memory usage for ‘Unity3d.exe’ will constantly increase) or if it will remain constant, or if there is another way to determine if there is a memory leak (even a tiny one)
I apologize if this was asked before, but no suggestions came up answering my question(s).