Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Arnavion
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
11 ms
·
121.
▲
by
Arnavion
1y ago
The speaker was mistaken / misspoke. The closest thing to "conditionally returned to the kernel" is if the page had been given to madvise(MADV_FREE), but that would still not have the behavior they're talking about. Read
122.
▲
by
Arnavion
1y ago
That's what (b) is about.
123.
▲
by
Arnavion
1y ago
A read from an unmapped page producing a different value than reading from that same page after it's mapped is an OS bug (*). If this was an already allocated page that had something written to it, reading from it would page it back in
124.
▲
by
Arnavion
1y ago
A non-idiot would use calloc(DEFINITELY_BIG_ENOUGH), and that will likely erase the difference because the impl will be able to rely on mmap(ANONYMOUS) creating zero pages for such a large allocation. A more realistic test would be to have
125.
▲
by
Arnavion
1y ago
It does, though even for a small segment you end up needing a lot of boilerplate - a dependency on the cc crate, a build.rs that invokes the cc crate, extern declarations to tell the Rust caller about the C function, potentially some bindge
126.
▲
by
Arnavion
1y ago
As I wrote in https://news.ycombinator.com/item?id=44048391 , you have to get used to copying the libstd impl when working with MaybeUninit. For my code I put a "TODO(rustup)" comment on such copies, to remind mys
127.
▲
by
Arnavion
1y ago
Also not every type has a valid "all zeroes" value in the first place.
128.
▲
by
Arnavion
1y ago
There is a limited form of such "expression rewriting" using tagged template strings introduced in ES2015. But it wouldn't be particularly useful for the ORM case.
129.
▲
by
Arnavion
1y ago
No. The correct way to write that code is to use .spare_capacity_mut() to get a &mut [MaybeUninit<T>], then write your Ts into that using .write_copy_of_slice(), then .set_len(). And that will not be any slower (though obviously m
130.
▲
by
Arnavion
1y ago
>I’ve also dealt with pain implementing similar interfaces in Rust, and it really feels like you end up jumping through a ton of hoops (and in some of my cases, hurting performance) all to satisfy the abstract machine, at no benefit to p
131.
▲
by
Arnavion
1y ago
This stopped being much of a problem when MaybeUninit was stabilized. Now you can stick to using &MaybeUninit<T> / &mut MaybeUninit<T> instead of needing to juggle *T / *mut T and carefully track converting tha
132.
▲
by
Arnavion
1y ago
>So fixing approx. 5-10% of CVEs (by zero-initializing all stack vars) is a worse cure than letting these uninitialized stack vars be possible sources of exploits? Read the comment you responded to again, carefully. It's not present
133.
▲
by
Arnavion
1y ago
Or let-else with a panic!() in the else {} if you want to use a format string.
134.
▲
by
Arnavion
1y ago
The standard is for software to report its own EOL / EOS status. The website you linked is the opposite direction - it's aggregating that status for a certain set of software.
135.
▲
by
Arnavion
1y ago
Some distros packaging Rust software (OpenSUSE at least) also transparently set up CARGO=cargo-audit to get embedded SBOMs.
136.
▲
by
Arnavion
1y ago
It doesn't force someone who already wasn't checking their dependencies for CVEs / maintained-ness to start doing that. It does make someone who *was* doing that be able to show they're doing that in some standard way. I
137.
▲
by
Arnavion
1y ago
Its new owner since 2010 is still part of the Asus group, but sure it's technically a different company from Asus proper.
138.
▲
by
Arnavion
1y ago
Any mobo will let you download the firmware file to a FAT32-formatted USB drive etc, and then use that to update the UEFI within the UEFI UI. Yes some mobos have the feature in their UEFI to connect to the internet and download the update,
139.
▲
by
Arnavion
1y ago
And in fact is not even something that Rust does differently from C++. Memory releases in Rust are handled by dtors just like they are in C++. What a weird article. (The only difference is that Rust defaults to moving while C++ defaults to
140.
▲
by
Arnavion
1y ago
Yes, if you want to go that route, you'll be better off going with RISC-V.
141.
▲
by
Arnavion
1y ago
Asrock (sub-brand of Asus but seemingly independent in the product and dev side) has been fine for me over the ~10 years I've bought their mobos. There was the thing a few months ago with X870 mobos that were apparently frying CPUs, bu
142.
▲
by
Arnavion
1y ago
Yes that's correct, for exactly the reason that it is more likely to keep compiling and possibly not do what you intended if the original value's type changes due to refactoring. However there are still a few conversions that don&
143.
▲
by
Arnavion
1y ago
Sorry, the code is closed source.
144.
▲
by
Arnavion
1y ago
The allocator we wrote for $dayjob is essentially a buffer pool with a configurable number of "tiers" of buffers. "Static tiers" have N pre-allocated buffers of S bytes each, where N and S are provided by configuration f
145.
▲
by
Arnavion
1y ago
Various kind of "desktop" applications like databases and video games use custom non-global allocators - per-thread, per arena, etc - because they have specific memory allocation and usage patterns that a generic allocator does no
146.
▲
by
Arnavion
1y ago
To be clear, the only difference between Rust and C here is whether the conversion happens by default or not. Rust doesn't do the conversion by default but will let you do it if you want to, with `as`. There are also more type-safe con
147.
▲
by
Arnavion
1y ago
Explicit allocators do work with Rust, as evidenced by them already working for libstd's types, as I said. The mistake was to not have them from day one which has caused most code to assume GlobalAlloc. As long as the type is generic o
148.
▲
by
Arnavion
1y ago
Result<Option> is the correct way to represent this, and if you need further convincing, libstd uses it for the same reason: https://doc.rust-lang.org/stable/std/primitive.slice.html?se...
149.
▲
by
Arnavion
1y ago
>many functions allocate memory and what are they supposed to do when there is no memory left? Return an AllocationError. Rust unfortunately picked the wrong default here for the sake of convenience, along with the default of assuming a
150.
▲
by
Arnavion
1y ago
The reason to introduce the Quantity wrapper is to not be able to swap the quantity and price arguments.
More ›