Re: memory leak or not?
- From: "Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx>
- Date: Fri, 3 Nov 2006 19:53:38 +0100
Jon,
I think you are wrong, however it does nothing add to the question from the
OP.
In my opinion was the reply from Marina more than enough,
So I stop this discussion.
Cor
"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> schreef in bericht
news:MPG.1fb5932e29281cd198d5c2@xxxxxxxxxxxxxxxxxxxxxxx
Cor Ligthert [MVP] <notmyfirstname@xxxxxxxxx> wrote:
My text was not meant as you read it.
I was implying that there was a new object instanced, and not only a new
reference to an existing object.
You can't possibly know whether a new object was created or not.
object A = MyJonObject;
is different from
string A = MyJonObject.ToString();
I didn't call ToString() though - I called GrabSomeLongString(). We
don't know whether that method would create a new string or not - but
either way, the value of the variable would certainly be a reference.
As it had been a "normal" reference type the object would in my idea not
be
garbaged. (As it is not done in this case, to but the created string is
again a new object and that will be garbaged)
String *is* a "normal" reference type. Its immutability has nothing to
do with ths.
Marina was in my idea talking about normal non immutable reference types.
However I can of course not speak for here. Your sample is in my idea an
exception to the standard behaviour..
Not at all. There's nothing special about string here. You could change
string to any other type in my example and the behaviour would be the
same.
--
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: Jon Skeet [C# MVP]
- Re: memory leak or not?
- References:
- Re: memory leak or not?
- From: Marina Levit [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?
- Prev by Date: Re: DatagridView vs ListView
- Next by Date: Re: Generic List - Split list
- Previous by thread: Re: memory leak or not?
- Next by thread: Re: memory leak or not?
- Index(es):
Relevant Pages
|