News for hackers. Stuff that matters.
Re:Java 21 makes me like Java again by kaba0 on Saturday September 16, 2023 @07:05PM (#37539703)
var list = [];

while (true) { list.add(1); }

Here you are, which language won't leak memory here?

Also, which language will let you connect to a prod instance without a performance hit to get some stats on the heap and its allocated objects? Hell, you can even list every instance of a type as I've recently learned.

Re:Java 21 makes me like Java again by packetlost on Sunday September 17, 2023 @12:29AM (#37541530)
>var list = [];

> while (true) { list.add(1); }

idk, I don't think endlessly growing memory usage is really what a leak is, a leak is really when you have no way of accessing the allocated memory to free it (ex. dropping the last remaining pointer to a `alloc`'d block in C) or the opposite in garbage collected languages: accidentally holding onto a strong reference to objects that should be freed.

Re:Java 21 makes me like Java again by kaba0 on Sunday September 17, 2023 @03:04AM (#37542289)
> the opposite in garbage collected languages: accidentally holding onto a strong reference to objects that should be freed

So basically what I gave an easy example of. Sure, it won’t look like this in practice, you probably accidentally keep adding to a list, or a cache, but basically this is what happens. The former kind of leak can’t happen with tracing GCs.