Re: memory leak or not?
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Sat, 4 Nov 2006 12:36:50 -0000
Cor Ligthert [MVP] <notmyfirstname@xxxxxxxxx> wrote:
Read my whole post,
The first object A from this reply I have showed you is not garbaged as the
MyJonObject is not instanced in this method. The second will, because it
holds outside the method no reference anymore.
object A = MyJonObject;
is different from
string A = MyJonObject.ToString();
You introduced that example *after* contradicting my earlier example,
and introduced the example for no well-explained reason.
Note, however, that *again* there is nothing magical about strings
here. If you had written:
SomeOtherType x = MyJonObject.CreateSomeOtherType();
that would be exactly parallel to
string A = MyJonObject.ToString();
In other words, the fact that I used a string type is irrelevant, and
the fact that strings are immutable is irrelevant to their garbage
collection.
To make things clear:
a) there is no difference between strings and other reference types in
terms of whether variables hold reference
b) in my first example, contrary to your reply, what I was showing most
certainly *was* a reference.
And please keep answers by what I wrote; not what you have written that *I*
wrote;
I quoted your post exactly.
if we search on how many times you did that and how many times I
have asked you that when you don't understand my replies to ask specify what
I meant than we get endless messages. Not only by me by the way. I am
writting here mostly in a style expectiong that people are proffesionals not
amateurs in development and only need few words.
You are writing here in a style which is *frequently* hard to
understand - and not just by me.
Now, you have said that you believe I am wrong. Please state *exactly*,
in precise technical terms, in what way any of what I have posted in
this thread is wrong.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: memory leak or not?
- From: Cor Ligthert [MVP]
- Re: memory leak or not?
- From: Cor Ligthert [MVP]
- Re: memory leak or not?
- References:
- Re: memory leak or not?
- From: Cor Ligthert [MVP]
- Re: memory leak or not?
- From: Jon Skeet [C# MVP]
- Re: memory leak or not?
- From: Cor Ligthert [MVP]
- Re: memory leak or not?
- From: Jon Skeet [C# MVP]
- Re: memory leak or not?
- From: Cor Ligthert [MVP]
- Re: memory leak or not?
- From: Jon Skeet [C# MVP]
- Re: memory leak or not?
- From: Cor Ligthert [MVP]
- Re: memory leak or not?
- From: Jon Skeet [C# MVP]
- Re: memory leak or not?
- From: Cor Ligthert [MVP]
- Re: memory leak or not?
- From: Jon Skeet [C# MVP]
- Re: memory leak or not?
- From: Cor Ligthert [MVP]
- Re: memory leak or not?
- Prev by Date: Re: Why am I getting out of range exception with these code?
- Next by Date: Re: Connection to SQL database on local computer
- Previous by thread: Re: memory leak or not?
- Next by thread: Re: memory leak or not?
- Index(es):
Relevant Pages
|