Re: memory leak or not?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Jon, will you please provide a reference where I can read about this?

Jon Skeet [C# MVP] wrote:
....
In this particular case it's true, but in a more general case it can be earlier. For instance:

void Foo()
{
string x = GrabSomeLongString();
Console.WriteLine (x.Length);

// Lots more code here

// Nothing referring to x

// End of method
}

The variable "x" does not prevent the long string from being garbage collected (in release mode) before the end of the method, even though it's still in scope.

.



Relevant Pages

  • Re: HashTable.Add Modifies HashTable Items?
    ... I am admittedly mistaken about the String and Integer values, ... Class2 are in the same AppDomain, they receive different copies of the ... shared member variables. ... Jon Skeet - ...
    (microsoft.public.dotnet.framework)
  • Re: fomat string with 2 decimal places
    ... You're trying to format a string as if it were a number. ... removing the call to ToString. ... Jon Skeet - ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.general)
  • Re: read multiple values from textbox are process them
    ... Jon Skeet [C# MVP] wrote: ... Potentially trim each string ... e.g. a map or array from number to line ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: char[] to DateTime
    ... > string and one GC is going to affect you that much? ... char[] needs to be GC'd as well. ... Jon Skeet - ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Instrumentation + BCEL | ASM
    ... final String owner, ... Strangely enough, with this method added, I can only transform methods with exactly one argument of type String). ... But I don't seem to know how to get hold of method signature, so there can be problems if consecutive threads call timed methods with the same name, but different signatures. ... private void genStartCode() { ...
    (comp.lang.java.programmer)