c# - Cleaning up variables in methods -
c# - Cleaning up variables in methods -
i having memory issues in big piece of software work on, looking through methods have written declaring variables @ origin of method, not beingness cleaned (nullified or disposed) @ end of method.
public static bool checkisnumber(string x) { int y; return(int.tryparse(x, out y)); } as see above, y never set null or disposed or that, thought picked gc, after looking through memory profiler, not sure anymore.
there's distinction between variable going out of scope , garbage collection in .net. microsoft lists 3 conditions trigger garbage collection:
the scheme has low physical memory. the memory used allocated objects on managed heap surpasses acceptable threshold. the gc.collect method called.source: http://msdn.microsoft.com/en-us/library/ee787088(v=vs.110).aspx#conditions_for_a_garbage_collection
when i've looked @ memory usage of .net apps, rising steadily point after garbage collector collects , memory usage drops again. best can tell that's how it's meant work.
c#
Comments
Post a Comment