Re: Do local references destruct on method exit?

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



No. The byte array doesn't disappear. The variable "bytesArray"
disappears, but the value of that variable was just a reference. The
byte array itself is on the heap, and isn't local at all.

Hi Jon, yes, exactly. It was your page on parameter passing that
makes it so clear (and also with the addendum with pictures) that
shows why this is the case, but I just had to be sure. I just
finished testing it to be positive.

Thanks

Zytan


.



Relevant Pages

  • Re: Garbage collectable pinned arrays!
    ... reference to it anywhere on the call stack. ... But collecting the object and ... When the array is pinned it is copied to heap. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Garbage collectable pinned arrays!
    ... to see is an option to allocate the array on the heap initially. ... by putting GC.KeepAliveafter the unmanaged code call. ... The reason for this is that the JIt doesn't know about unmanaged code, as a result he *marks* the reference "ia" as a candidate for collection (signals the GC that the object ia refers to may be collected at the moment of the call. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Garbage collectable pinned arrays!
    ... reference to it anywhere on the call stack. ... But collecting the object and ... When the array is pinned it is copied to heap. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Garbage collectable pinned arrays!
    ... reference to it anywhere on the call stack. ... But collecting the object and ... When the array is pinned it is copied to heap. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Garbage collectable pinned arrays!
    ... reference to it anywhere on the call stack. ... But collecting the object and ... When the array is pinned it is copied to heap. ...
    (microsoft.public.dotnet.languages.csharp)