Hacker News new | ask | show | jobs
by slaymaker1907 1983 days ago
That is not true about C#, it has an unsafe keyword for using raw pointers. Also, the Unsafe class in Java does a bunch of unsafe stuff as well not to mention that Java can call out to C code as well.

A garbage collector won't help you avoid a very common memory leak of having an unbounded cache.

3 comments

And using it taints the produced binaries.

You can configure the compiler, runtimes or web servers to refuse to load tainted unsafe binaries.

> it has an unsafe keyword for using raw pointers

It has, but you don‘t need it to implement data structures. Standard library developers don’t need it either, they all implemented in safe code.

But it is almost never used (recently the unsafe package even got deleted). And Java has basically everything else written in Java, so it is not as often used as Rust’s unsafe.

Java will have a safe foreign memory API soonish.