4 ms·
"They said high level languages relieved us from thinking about memory issues" nobody said that. I'd even claim the opposite. For example, to develop a game on
by Kenji 12y ago
"They said high level languages relieved us from thinking about memory issues" nobody said that. I'd even claim the opposite. For example, to develop a game on Android (Java) or in the browser (JavaScript) you need to work around the garbage collector the best you can with techniques like object pooling, or else your entire program stops every 3 seconds. It's just nasty. Know thine enemy, know thine garbage collector.
- jasode 12y ago>nobody said that. What's your definition of "nobody"? :-) Actually, many people said it all the time -- especially during 1995/1996 when Java hype was gearing up. It was touted as a selling point in Java books, JavaWorld articles, usenet postings, etc. Examples: --Java also implements automatic garbage collection, so you don't have to worry about memory management issues. All of this frees you from having to worry about dangling pointers, invalid pointer references, and memory leaks, so you can spend your time developing the functionality of your programs."[1] --Programmers can be relatively fearless about dealing with memory because they don’t have to worry about it getting messed up.[2] --Java also implements automatic garbage collection, so the programmer does not have to worry about memory management issues.[3] --The entire interaction with memory is worry-free in Java.[4] The issue of "GC pauses" or "extra memory footprint required for performance" is not mentioned in any of those sources. It's not Java's fault that it's presented this way because every technology is hyped by only listing the advantages and avoiding the talk about disadvantages. [1]1996 edition of David Flanagan's "Java in a Nutshell" -- https://books.google.com/books?ei=ZDHOVOztD4z8sASIsoKYAg&id=ibCWvFAnov8C&dq=1565921836&focus=searchwithinvolume&q=worry https://books.google.com/books?ei=ZDHOVOztD4z8sASIsoKYAg&id=... (he removed the phrase "don't have to worry about memory management issues" from newer editions of the book: https://books.google.com/books?id=mvzgNSmHEUAC&printsec=frontcover&dq=java+nutshell+worry+memory&hl=en&sa=X&ei=JyzOVMzsJIi1sQTOroHoBQ&ved=0CB8Q6AEwAA#v=snippet&q=memory&f=false https://books.google.com/books?id=mvzgNSmHEUAC&printsec=fron...) [2]James Gosling - http://www.cs.dartmouth.edu/~mckeeman/cs118/references/OriginalJavaWhitepaper.pdf http://www.cs.dartmouth.edu/~mckeeman/cs118/references/Origi... [3]http://www.trailstone.com/softdeve/java/overview.html http://www.trailstone.com/softdeve/java/overview.html [4]http://wellscs.com/robert/java/productivity.htm http://wellscs.com/robert/java/productivity.htm
- JoeAltmaier 12y agoFew have said it since those foolish comments back in 1995. That pretty much is 'nobody'.
- tbrownaw 12y agoNo, people still say those things. Try saying something in favor of C++, you'll see what I mean. :)
- sgift 12y agoI see a very big gap between "memory issues" and "memory management issues" ... for me the first thing is "thinking about memory, how much you will use, etc.", the second is "Okay, I've allocated a string here. Who the heck will be the one that cleans it up?" - high level languages fix the second case (if you LIKE the fix, that's a different topic, but it is a fix), they don't (and cannot and never were claimed to) fix the first case, because that would need an AI like runtime environment. (Okay, your quote [4] is actually talking about both, so .. one of four examples fits?)
- Coding_Cat 12y agoYou are absolutely right on the fact that it doesn't, but I have seen plenty of people claim that high-level languages absolve you from having to think about memory. Wikipedia says: >"[High level languages] may [...] automate (or even hide entirely) significant areas of computing systems (e.g. memory management)" And I think most people who make such claims have read similar statements and simply confuse memory-management with thinking about memory issues. (The distinction is that well defined anyway).
- MichaelGG 12y agoThis isn't a case of a memory management issue. It's a case of someone using an O(n) algorithm instead of O(1). There's not a memory layout that would change this. Even if you used an array, if you iterated over it, it'd still be rather expensive. This is also what abstractions are for. Instead of killing your perf by using an unsuitable data structure, implement the same interface, but with a fast implementation. Using linked list for this scenario seems suboptimal.
- davidw 12y agoTo be fair, for a lot of things, GC certainly does delay or obviate thinking too much about memory management. This lets you explore the problem space and get something built and then maybe later optimize where needs be, if it proves necessary.
- k__ 12y agoYes. Most of the time GC is good enough.