News for hackers. Stuff that matters.
Re:Leveraging Rust in our high-performance Java database by Quekid5 on Wednesday September 20, 2023 @09:09AM (#37583661)
> How is it memory safe if they are using off heap memory with malloc/free? I think it would only qualify as memory safe if they were using the GC which they purposefully avoid.

You can still write a safe/minimal wrapper around that with just the actual API you need. (Instead of allowing everything to just peek/poke around in arbitrary off-heap memory.)

Re:Leveraging Rust in our high-performance Java database by gpderetta on Wednesday September 20, 2023 @09:56AM (#37584170)
how do you prevent use-after-free with a wrapper?
Re:Leveraging Rust in our high-performance Java database by ElectricalUnion on Wednesday September 20, 2023 @10:38AM (#37584752)
They're not GCing/freeing memory at all, but if they were, you free memory by trashing all your references that could use-after-free so it's not an issue.
Re:Leveraging Rust in our high-performance Java database by nu11ptr on Wednesday September 20, 2023 @09:59AM (#37584213)
I think this is an argument for correct program architecture/design, not one for language. I suspect one could do the same thing in any memory unsafe language. Granted, Java might make this somewhat easier by not having the concept of modifiable pointers, but discipline and static analysis could likely achieve the same.
Re:Leveraging Rust in our high-performance Java database by Quekid5 on Wednesday September 20, 2023 @12:44PM (#37586468)
> I suspect one could do the same thing in any memory unsafe language. Granted, Java might make this somewhat easier by not having the concept of modifiable pointers, but discipline and static analysis could likely achieve the same.

You can theoretically, but nobody has shown persuasively how to do it. The problem is when anything can be unsafe, everything can. Small safe abstractions using unsafe primitives "under the hood" in a safe language are king.