Comment by CyberDildonics
2 years ago
The people who use software have absolutely no idea or opinion on the topic.
I asked 'the people who use software' and they don't like excessive memory usage or stuttering from bulk collection.
Also libraries written in a garbage collected language are only going to be usable in the same language.
Lots of people only think about the language they want to program in, then rationalize it being fine. That's how we got stuff like electron. When people think about what someone actually wants to receive that stuff goes away.
> I asked 'the people who use software' and they don't like excessive memory usage or stuttering from bulk collection.
Two of the most widely programming languages are implemented on top of garbage collected runtimes: JavaScript and Java. There are many applications where garbage collection works just fine.
> Also libraries written in a garbage collected language are only going to be usable in the same language.
See .net and the JVM. Those are nowadays runtimes with garbage collection and multiple languages.
https://en.wikipedia.org/wiki/List_of_JVM_languages
https://en.wikipedia.org/wiki/List_of_CLI_languages
Yet, out of 2489 packages installed on this machine, exactly zero are in Java, .Net, or Javascript. Why do you suppose that could be?
The only one that is a serious hog is the browser, for reasons you can probably deduce.
Pandoc, I will own, is in Haskell, but it never runs long enough to GC.
Two of the most widely programming languages
Widely used? This is the point. The programs that people use directly are written in C++. Programmers try to get away with garbage collection because it's what they want, not what people using software want.
Those are nowadays runtimes with garbage collection and multiple languages.
That's like saying typescript can be used in javascript, it's all the same underneath. It isn't the same as something native that can be used and consumed anywhere else. Software in non native languages keeps getting re-written over and over and not widely reused. Once someone does something natively and does it well like sqlite, image libraries, etc. it stays done.
> The programs that people use directly are written in C++.
There is a lot C/C++ around and they are widely used to implement runtimes for other languages, incl. garbage collection. Lot's of software people use directly or indirectly is written not in C++.
> That's like saying typescript can be used in javascript
That's another option how to integrate languages: TypeScript is transpiled to JavaScript. C can also be transpiled to JavaScript. Emscripten can compile LLVM instructions to JavaScript and Webassembly. JavaScript/Webassembly then gets compiled to native instructions.
low-level infrastructures like the JVM create native code from Java (and other languages using the JVM), by compiling to machine code.
> It isn't the same as something native that can be used and consumed anywhere else.
Programs with garbage collection also run "native". The garbage collector is a native part of the program.
> Once someone does something natively and does it well like sqlite
sqllite is not written in C++, it's written in C. As the first three letters tell us, it implements a language called SQL. sqllite also comes with its own dynamic memory management system: https://www.sqlite.org/malloc.html
sqllite is an excellent example, where C is used to implement a higher-level language (here SQL) and a complex memory management for it.
Btw., I'm typing this now on a iPad, where the user side of software is mostly implemented in Swift or Objective C, which use "reference counting" for memory management. The browser I'm typing to uses a system provided JavaScript engine with garbage collection. The site I'm using (Hackernews) is written in Arc (which is a Lisp dialect), which runs on top of a variant of Scheme, which is another Lisp dialect, which provides a garbage collector.
4 replies →
How did you get from “garbage collection” to “excessive memory usage”?
Yet, it is what we experience. One GC program on a machine may perform well. Two are a problem.
You didn’t answer my question. Why, in general, wouid a garbage-collected language consume more memory?
2 replies →