Re: memory leak or not?



"Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx> wrote in message
news:uc23j2BAHHA.3560@xxxxxxxxxxxxxxxxxxxxxxx
Jon,

You are writing here in a style which is *frequently* hard to
understand - and not just by me.

Said by probably the record holder of long newsgroups threads.

The normal (question) threads where I am active in are mostly not
longer than 3.
One for the question,
One for my answer
One for the thanks I get for the answer.

I am in this not speaking about this newsgroup because here I am not
so active as in 3 other major dotNet newsgroups.

Cor

The reason for these lengthy threads involving you and Jon is that YOU
don't ever admit that YOU made a mistake. Or you don't grasp that you
HAVE made a mistake. Instead, you continue to insist that we are
twisting your words.

Here is your original post
<post>
Jon,

I am glad I can help you with this.
The string is immutable what you are showing is not a reference.
You can have a look at what immutable means at these pages.
http://www.yoda.arachsys.com/csharp/parameters.html

:-)

Cor
</post>

OK....strings are immutable....but what has that got to do with
anything? And what was returned was definitely a reference....so I am
not sure what you talking about???? The link to Jon's Page (cute) did
talk about immutable objects, but I still don't see the relevance to the
discussion. I suggest that you re-read the page yourself, because I
suspect that you lack of understanding of "immutable" as a large part of
the problem.

The only thing that I can think of to explain your statement is this
quote from Jon's page
<quote from Jon's page>
Note that many types (such as string) appear in some ways to be value
types, but in fact are reference types. These are known as immutable
types. This means that once an instance has been constructed, it can't
be changed. This allows a reference type to act similarly to a value
type in some ways - in particular, if you hold a reference to an
immutable object, you can feel comfortable in returning it from a method
or passing it to another method, safe in the knowledge that it won't be
changed behind your back. This is why, for instance, the string.Replace
doesn't change the string it is called on, but returns a new instance
with the new string data in - if the original string were changed, any
other variables holding a reference to the string would see the change,
which is very rarely what is desired.
</quote from Jon's page>

John talks about immutable type acting like value types instead of
reference types. This does not prevent immutable objects from obeying
the rules of garbage collection. It simply means that you know that the
object will not change.

None of this has anything to do with references or garbage collection
(the point of the original post).

Therefore, it is clear to me that what you wrote is not what you meant
or else you don't really understand references and immutability. Perhaps
we can clear this up for you.

Bill
















.



Relevant Pages

  • Re: Datasets? Properties? Values?
    ... >> passed by its value of the pointer to its starting adres and by a change ... You can't change the contents of a string, ... > reference to one DataSet to a reference to another DataSet. ... The immutability just means there ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Datasets? Properties? Values?
    ... >> passed by its value of the pointer to its starting adres and by a change ... You can't change the contents of a string, ... > reference to one DataSet to a reference to another DataSet. ... The immutability just means there ...
    (microsoft.public.dotnet.framework)
  • Re: Datasets? Properties? Values?
    ... >> passed by its value of the pointer to its starting adres and by a change ... You can't change the contents of a string, ... > reference to one DataSet to a reference to another DataSet. ... The immutability just means there ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Datasets? Properties? Values?
    ... >> passed by its value of the pointer to its starting adres and by a change ... You can't change the contents of a string, ... > reference to one DataSet to a reference to another DataSet. ... The immutability just means there ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Datasets? Properties? Values?
    ... >> passed by its value of the pointer to its starting adres and by a change ... You can't change the contents of a string, ... > reference to one DataSet to a reference to another DataSet. ... The immutability just means there ...
    (microsoft.public.dotnet.general)

Loading