Hacker News new | past | comments | ask | show | jobs | submit login

Memory safety is easy if you use GC (so don't have to define lifetimes) and mandatory bounds checking (unless compiler/JIT can convince itself that it is not necessary). Arguably these tradeoffs are the correct choice for a large majority of all applications — developers agree, looking at the popularity of Python, Java, .NET, Go, PHP, Perl, ...



The biggest leak I’ve seen was in the JavaScript (qml) side of a C++/qml app. You can still leak in GC languages by inadvertently holding on to things you are done with. The GC encourages you to not think about it, which is a problem.


I disagree. Just because there is a GC, it doesn't mean one does not have to be aware of the existence of memory. OOM errors are thing even without leaks in GC languages.

Besides, leaks are only a small part of memory safety anyways.

And I'm not surprised that you find the biggest leak in Javascript, the language that probably the biggest percentage of amateur/inexperienced developers are working in. (which is not generally a bad thing, but increases the chance for these bugs)


Agreed. At a certain point thinking about garbage collection becomes more burdensome than just handling allocation explicitly.


There reference counting has an advantage of being deterministic, so it is easier to reason about than full garbage collection


I don't consider memory leaks a memory safety issue since all they do use use up memory and cause failing allocations, which has to be handled one way or another regardless whenever you use dynamic memory.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: