BitFlipper said:
magicalclick said:
*snip*

The float is a value type so it is not a problem in this case. But calling float.ToString() allocates a string, which is a ref object. You say fps.ToString() is released right after the line ends. Released to where? This has everything to do with garbage.

float.ToString()?

 

return values from a function call is stored in the call stack or something right? It is push right at return and pop right at caller line. It is just C++. You don't need to release anything for that in C++. Unless XNA is so much different from C++ and C# that we will have to release every single return primitive? String is a special primitive that will be released automatically in C++. I am just talking about C++. And there is no additional action needed to be done in C++. C# is just doing the same as C++ on this part.

 

In C++, if you return an object, you don't release until you want to kill it. In C#, you can release it manually or wiat for GC. In XNA, I assume it is C#.