Live data from Hacker News

The Garbage Collection Handbook, 2nd Edition

routledge.com

101–110 of 174 posts

Re: The Garbage Collection Handbook, 2nd Edition

#101

Earlier quoted context omitted.

1. It’s a joke 2. Many great programmers hold the opinion that Java is horrible. Linus for example. So if Sewell doesn’t seem credible, try the creator of Linux and git.

> Many great programmers hold the opinion that Java is horrible. Could you name a few?

Linus, Dijkstra, Stroustrup, to name a few.

Time has shown OOP is not good.

Re: The Garbage Collection Handbook, 2nd Edition

#103
I don't know if it is included in the new edition of the book but in case anyone is interested in a modern, highly efficient RC implementation that does not rely on deferring the reference count updates (which kills one of the advantages of RC in the first place), check the Perseus paper. Koka (which uses perseus) is quite competitive with OCaml and Haskell

Just search for "perseus reference counting", you'll find it. It uses linear logic to insert explicit "dup/drop" operations and then merges and coalesces them.

Re: The Garbage Collection Handbook, 2nd Edition

#104
post #80

Earlier quoted context omitted.

They would appreciate your contribution to fix the benchmark. Apparently the ARC performance improvements announced at WWDC 2022 weren't needed.

I don’t think they would, considering they’ve already finished their study.

You could have your own repo to counterpost every time someone like me refers to that old study with tainted results.

Re: The Garbage Collection Handbook, 2nd Edition

#105

I don't know if it is included in the new edition of the book but in case anyone is interested in a modern, highly efficient RC implementation that does not rely on deferring the reference count updates (which kills one of the advantages of RC in the first place), check the Perseus paper. Koka (which uses perseus) is quite competitive with OCaml and Haskell Just search for "perseus reference counting", you'll find it…

Is there any particular reason you didn't link to the paper itself (https://www.microsoft.com/en-us/research/uploads/prod/2020/1...) or use Microsoft's scuffed version of DOI (MSR-TR-2020-42)? The paper appears to be freely available, so there shouldn't be copyright issues with linking to it...

Re: The Garbage Collection Handbook, 2nd Edition

#106

Earlier quoted context omitted.

> Many great programmers hold the opinion that Java is horrible. Could you name a few?

Linus, Dijkstra, Stroustrup, to name a few. Time has shown OOP is not good.

Then it’s great that Java is a general purpose programming language with plenty of ways to do FP as well.

Also, being good at some subset of CS doesn’t mean they are good at language design.

Re: The Garbage Collection Handbook, 2nd Edition

#107

I don't know if it is included in the new edition of the book but in case anyone is interested in a modern, highly efficient RC implementation that does not rely on deferring the reference count updates (which kills one of the advantages of RC in the first place), check the Perseus paper. Koka (which uses perseus) is quite competitive with OCaml and Haskell Just search for "perseus reference counting", you'll find it…

Is there any particular reason you didn't link to the paper itself ( https://www.microsoft.com/en-us/research/uploads/prod/2020/1... ) or use Microsoft's scuffed version of DOI (MSR-TR-2020-42)? The paper appears to be freely available, so there shouldn't be copyright issues with linking to it...

Just that I'm on mobile and am lazy. Thanks for posting it!

Re: The Garbage Collection Handbook, 2nd Edition

#109

I feel the need for garbage collection is a language design mis-feature. That is to say, producing garbage is a language design-mis-feature. To quote Bjarne Stroustrup: > I don't like garbage. I don't like littering. My ideal is to eliminate the > need for a garbage collector by not producing any garbage. That is now > possible. and it's indeed possible. For example It's become pretty much a non-issue in modern C++:…

More and more people nowadays are programming at high levels of abstraction. If you're designing the frontend of a website, or making a mobile game, or developing a stock trading algorithm, or whatever else, then you probably don't want to constantly worry about details of memory management... On top of this, GC is necessary for some algorithms. Any data structure with partial sharing (e.g. binary search tree with ve…

> then you probably don't want to constantly worry about details of memory management...

Oh, you actually don't have to, that's the whole point... in the past, you (effectively) had a choice between careful manual management of memory and garbage collection with its overheads. These days, you can use constructs which take care of that management for you, with very little or no overhead, which don't involve garbage.

It's true that sometimes GC is algorithmically necessary; but then the high-level-of-abstraction argument is irrelevant. And in those cases, a GC library does indeed come in useful. You don't need to write your own, others have likely done it already.

Re: The Garbage Collection Handbook, 2nd Edition

#110
post #97

Earlier quoted context omitted.

Bob Nystrom (of Game Programming Patterns , Crafting Interpreters , and dartfmt fame) also wrote a tutorial implementation[1], of a precise tracing GC as opposed to a conservative one. Regarding register scanning in a conservative GC, Andreas Kling has made (or at least quoted) the amusing observation[2] that your C runtime already has a primitive to dump all callee-save registers to memory: setjmp(). So all you have…

Glibc's mangles some pointer registers in setjmp(). It XORs a per-process value with the stack pointer, frame pointer and instruction pointer stored in the jmp_buf, on all (or nearly all) architectures. Although losing the stack and instruction pointers is unlikely to be a problem for the GC context, the frame pointer register need not contain a frame pointer value. It can be an arbitrary program value depending on c…

You’re right, and I shouldn’t have dismissed the PTR_MANGLE business so easily when I looked at the source[1]. In hindsight, the __ILP32__ (i.e. x32) special case for the high part of %rbp on x86-64 looks awfully suspicious even if you don’t know the details.

Given that __attribute__((optimize("no-omit-frame-pointer"))) doesn’t seem to get GCC to save the parent frame pointer on the stack reliably, while Clang doesn’t understand that atribute (or #pragma GCC optimize(...)) at all, this now looks less slick than it initially seemed.

... Have I mentioned that I dislike hardening techniques?

[1] https://elixir.bootlin.com/glibc/glibc-2.37/source/sysdeps/x...

Post reply on HN