News for hackers. Stuff that matters.
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by chrisseaton on Wednesday August 05, 2020 @08:54AM (#24060257)
> In D, the GC is guaranteed to only ever run if you allocate new memory on the heap.

Isn't that how most GCs work?

Why would you do anything else? To release memory to the OS? That's not really a priority in most runtime systems, and I think wanting to do that is a pretty niche requirement.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by frant-hartm on Wednesday August 05, 2020 @09:12AM (#24060395)
I want memory allocation to run in constant time, so I can achieve low latency. That's the point of concurrent GCs - they run in the background to free up memory.
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by chrisseaton on Wednesday August 05, 2020 @09:30AM (#24060533)
I know they run in the background... but I don't think they run in the background if there's nothing to do, do they?
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by imtringued on Wednesday August 05, 2020 @04:43PM (#24065369)
A JVM with default settings will happily allocate more memory without attempting to even run a single GC cycle until it hits the configured heap size. Once it hits the limit it will try to run the GC.
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by readittwice on Wednesday August 05, 2020 @10:14AM (#24060975)
Releasing memory is definitely useful for mobile devices or browsers. Even in some server use cases it's useful, e.g. when you pay for memory usage. I guess that's why the JVM has this -XX:SoftMaxHeapSize option.

I guess it depends whether GCs are always scheduled in an allocation or can be triggered another way. Either way that should be easy to disable.

I read somewhere that D doesn't have write barriers, so I would assume they have a hard time implementing more advanced GC features like generational collection or concurrent marking. It's not suprising that the GCs in the JVM achieve much better pause time.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by nemothekid on Wednesday August 05, 2020 @09:12AM (#24060403)
In Java, everything is heap allocated, whereas in D you have a choice.
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by chrisseaton on Wednesday August 05, 2020 @09:30AM (#24060535)
> everything is heap allocated

You can definitely write useful Java applications where nothing gets heap allocated, through using existing objects, and through using scalar-replacement-of-aggregates.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by wokkel on Wednesday August 05, 2020 @09:46AM (#24060671)
Not entirely correct: https://shipilev.net/jvm/anatomy-quarks/18-scalar-replacemen... . Hoi cannot force a specific allocation, but the jit does do something akin to stack allocation.