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

> At least a GC knows where your memory blocks are and doesn't double free them.

Wrong. Counterexample: https://mail-archives.apache.org/mod_mbox/subversion-users/2... (Obtained by a quick search of "garbage collector double-free bug" - there are many others out there)

> Have you ever looked into ParaSail, Rust, ATS?

ParaSail and Rust don't have a GC, period, AFAIK. ATS is too strict for my liking. (I want a programming language that will refuse to compile if it can find a "counterexample" that will assert, but will compile something (with a warning and inserted runtime checks unless explicitly marked otherwise) even if it cannot prove something is correct.)




>Obtained by a quick search of "garbage collector double-free bug" - there are many others out there

Yeah, a bug.

I'd rather worry about double free being the case of a GC bug -- in a shared core code that can be fixed and the problem will vanish for everyone -- than in anywhere I have to free memory myself.


> Wrong.....

I don't touch Perl since 2004. Back then it used reference counting, not a GC.

Second, the post reads like a problem in the C code.

> ParaSail and Rust don't have a GC, period, AFAIK. ATS is too strict for my liking.

I was replying about GC alternatives for automatic memory management.


> the post reads like a problem in the C code.

Exactly. All GC does is push down the code that can cause problems like double-frees into the language implementation. It doesn't magically make problems like double-free bugs impossible, like so many people say.

> I was replying about GC alternatives for automatic memory management.

Then why did you respond to and quote something that was talking about something entirely different?


>Exactly. All GC does is push down the code that can cause problems like double-frees into the language implementation. It doesn't magically make problems like double-free bugs impossible, like so many people say.

That's like saying moving the likelihood of an event from 1/100 to 1/10000000, and only under very specific pre-conditions that are easily detactable, doesn't make it impossible.

That is, you are technically correct, which is the worst kind of correct.

The difference between double-free bugs in stuff "pushed down in the language implementation" and double-free bugs in programmer's own code is so huge, it's a total game changer.


> Exactly. All GC does is push down the code that can cause problems like double-frees into the language implementation. It doesn't magically make problems like double-free bugs impossible, like so many people say.

The difference being the compiler vendor vs all the developers using the language.

> Then why did you respond to and quote something that was talking about something entirely different?

Maybe my bad English could not decipher "where the compiler could determine when they can be thrown away, matters would be different. (So, in other words, the compiler inserts `malloc` (or whatever) calls, and ensures that every variable created is either `free`d exactly once after it becomes unreachable".




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

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

Search: