Hacker News new | ask | show | jobs
by microtonal 2920 days ago
One just has to know which situations the GC can't cope with and avoid them.

Unfortunately, many programmers believe that since Java uses garbage collection, you do not have to think about GC and ownership at all.

Oracle had to replace the fast implementation of substring that just returns a slice of a String (O(1) time) by a copying implementation (O(n)), because too many programmers do not know the basics of ownership/garbage collection and would accidentally hold on to larger strings.

Seeing the implementation details of reference counting, mark-sweep collection, and perhaps a generational collector once, makes you more aware of memory and ownership issues, even if you forget the nitty gritty details later.