News for hackers. Stuff that matters.
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by the8472 on Friday September 17, 2021 @07:32AM (#28564156)
If you don't use a GC then you're either using reference counting or manual memory management. Those have their own costs. With RAII popping stack frames means freeing resources recursively. If your free() implementation takes a lock then that can block other threads too, for an arbitrary time if the object graph being released is large.

A garbage collector can do that work concurrently.

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by cesarb on Friday September 17, 2021 @11:45AM (#28566814)
> With RAII popping stack frames means freeing resources recursively. If your free() implementation takes a lock then that can block other threads too, for an arbitrary time if the object graph being released is large.

For every RAII implementation I've seen, the recursive part is not within the free() implementation; the recursion happens outside the free() (or equivalent) calls, and free() (or equivalent) is called separately for each step, to release the memory for just that step. The time taken by each free() call is independent from the size of the object graph being released.

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by ncmncm on Friday September 17, 2021 @07:38AM (#28564213)
Not using GC. Not using reference counting. Not using "manual memory management".
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by matsemann on Friday September 17, 2021 @08:10AM (#28564501)
And not contributing to the discussion.

At least bring some alternatives to the table or explain what you are doing and why you mean it's so much better..

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by _ph_ on Friday September 17, 2021 @08:01AM (#28564425)
When I developed programs in Fortran 77, I did indeed have zero pauses, because all memory was allocated statically at the program start. With any form of dynamic memory, you have effort for managing that dynamic memory and thus pauses. The different technologies only result in those pauses happening at different times and other consequences. Modern GCs at least allow most of the necessary computation to happen in a parallel thread.
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by myrmidon on Friday September 17, 2021 @07:59AM (#28564408)
> With RAII popping stack frames means freeing resources recursively.

Your "GC pause" simply happens on scope-exit.

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by ncmncm on Friday September 17, 2021 @06:54PM (#28571811)
Except, without the pause.
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by notacoward on Friday September 17, 2021 @10:01PM (#28572889)
Oh, those cycles are free? That's not how I remember having to plan compute budgets and deadlines when I worked in real low-latency programming.
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by avianlyric on Friday September 17, 2021 @07:48AM (#28564307)
Erm something is managing your memory somewhere, even "the computer explodes before it runs out of memory" methodology used in guided missiles is a form of manual memory management, just a very unusual one.

Same applies to the "program terminates before it runs out of memory" approach.

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by ncmncm on Friday September 17, 2021 @06:10PM (#28571470)
Yes, something is managing my memory. Just not GC, and not reference counting (which is also GC). As I said.

C++ has destructors, and owning pointers (called "unique_ptr"), and also arena allocators for when those are useful. Rust has its Drop trait and analogs of the other things. (Use of arenas with Rust standard library containers is approaching maturity.) They make memory management automatic and wholly painless. Both languages offer reference-counted GC for places where that is helpful, but such places are rare, and where used typically burn an unmeasurably small fraction of runtime, with no "pauses".

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by avianlyric on Tuesday September 21, 2021 @01:02PM (#28607112)
Using destructors just reference counting done the hard way.

> burn an unmeasurably small fraction of runtime

That’s also known as a very short pause.

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by pjmlp on Friday September 17, 2021 @07:41AM (#28564240)
Yeah, right.

CppCon 2016: Herb Sutter “Leak-Freedom in C++... By Default.”

https://www.youtube.com/watch?v=JfmTagWcqoE

Better making use of the best practices advised by Herb, otherwise those destructors are going to surprise you.

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by eropple on Friday September 17, 2021 @07:50AM (#28564327)
It'll surprise him anyway, eventually. After all--humans aren't perfect programmers.
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by ncmncm on Friday September 17, 2021 @04:56PM (#28570796)
It has been more than thirty years since a destructor surprised me. Herb was unlikely to have been programming at that time.
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by pjmlp on Saturday September 18, 2021 @08:02AM (#28575533)
So what are your credentials in the C++ community to top those from Herb Sutter?
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by ncmncm on Saturday September 18, 2021 @07:58PM (#28580468)
Been on ISO C++ Standard committee for much longer than Herb? But I have no disagreements with Herb.
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by pjmlp on Sunday September 19, 2021 @04:29AM (#28582684)
And authored impactful C++ books and ISO C++ papers such as?
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by ncmncm on Sunday September 19, 2021 @03:57PM (#28587390)
I have no need to "top" Herb. He says nothing inconsistent with anything I have said.
Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by pjmlp on Monday September 20, 2021 @05:02AM (#28591629)
Apparently yes, when you place in doubt his advices,

> It has been more than thirty years since a destructor surprised me. Herb was unlikely to have been programming at that time.

So apparently you have skills that top one of the major C++ community figures.

Being so, the C++ community at large would appreciate those valuable insights.

Re:Shenandoah in OpenJDK 17: Sub-millisecond GC pauses by ncmncm on Tuesday September 21, 2021 @02:38AM (#28602545)
The only conclusion one can draw is that you are wholly unable to comprehend what you have just read, or aggressively don't care what it says. Either way, enough is enough.