On March 26, murtaghn at tcd.ie said:
>> So are you saying that there could be a programming language with
> memory management that always does the right thing, without you having
> to know what it's up to? (I say could be because I don't know of one
> that does this...)
Well, I'd offer Perl as an example because I've only once managed to
leak memory in Perl and that was when writing an extension for it in
C, and I've never had a Perl program thrash in quite the same way as a
Java program doing the same thing. I don't know that it does memory
management the right way all the time, because as I said I don't know
what it does with memory when I'm not looking. And perhaps you're
simply trying reductio ad absurdum on my opinion, because it's
impossible (at present) for a language to correctly second-guess all
aspects of what you're trying to do. Which is why I qualified my
original comment: memory management shouldn't matter unless you're in
a situation where exact memory accounting is essential.
My comment re: Java is simply that in Java it is far too easy to make
massive memory allocations without realising it because the language
is so focussed on everything being an object. Attempting to
concatenate the aforementioned Strings is a good example, since it
goes off on an Object-creation exercise that would be unnecessary if
the String class was mutable. And by naming it String instead of, say,
ConstantString, you're luring unwary programmers into using it as if
it were the equivalent of a C or C++ String.
> It's quite relevant. In something like Python, where reference counting
> is used to decide when an object is to be killed, you need to know that
> you are, in fact, passing references around, not copies, so if you
> save a reference somewhere, you are prolonging the life of the object.
Um. See, that's what scope is for. You keep your object handles in the
smallest scope possible, and then you forget about them. Because when
an object handle is out of scope, it is by definition no longer useful
and can be discarded. Again, Perl seems to handle this without me
having to worry about it, and I'm sure python does too. So I will
insist that pass by ref vs. pass by value is a completely irrelevant
sideline to the memory management issue.
waider at waider.ie / Yes, it /is/ very personal of me.
"what have i become? / my sweetest friend
everyone i know / goes away in the end" - NIN, "hurt" (the downward spiral)
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!