Coffeehouse Post

Single Post Permalink

View Thread: Interview with XNA Team
  • User profile image

    magicalclick said:
    BitFlipper said:

    Can you be a bit specific? Which one is the garbage? float fps? or + fps.ToString("F2")?


    fps is typically from a global variable anyway.

    and fps.ToString("F2") is released right after the line ends.

    if your float fps is in a method, it is released right away also.


    And none of them has anything to do with garbage. Isn't garbage only exists when you have class object? like car carObj = new car();

    Anyway, you can manually release obj too, just like C++. I am not expert on this, but, I remember they just say you shouldn't do it too often.


    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.