News for hackers. Stuff that matters.
Re:C++ std::move doesn't move anything: A deep dive into Val... by zbentley on Sunday January 11, 2026 @08:10AM (#46575439)
What does processor but width have to do with the likelihood of allocation failures?
Re:C++ std::move doesn't move anything: A deep dive into Val... by petcat on Sunday January 11, 2026 @08:55AM (#46575807)
640K ought to be enough for anybody!
Re:C++ std::move doesn't move anything: A deep dive into Val... by HarHarVeryFunny on Sunday January 11, 2026 @09:02AM (#46575851)
I think what he means is that on a 64-bit system you have a massive virtual address space (typically only 48-bit, but that's still 256TB), and since malloc allocates from virtual address space, not limited by physical memory, it is unlikely you will get a malloc failure (unless you are trying to allocate more than 256TB per process, maybe due to a memory leak).
Re:C++ std::move doesn't move anything: A deep dive into Val... by locknitpicker on Monday January 12, 2026 @02:31AM (#46585248)
> it is unlikely you will get a malloc failure

That assertion completely misses the point. The scenarios involving move constructors throwing exceptions involve objects being stuck in an inconsistent/zombie state. In fact, the whole point of a move constructors is to avoid having to allocate memory.

Re:C++ std::move doesn't move anything: A deep dive into Val... by zbentley on Tuesday January 13, 2026 @05:56PM (#46609577)
That's not true as generally as you might expect.

Folks might be using mmap with MAP_POPULATE; they might have overcommit turned off; they might be operating in an rlimit/cgroup (like most container runtimes/orchestrators configure) that limits memory; they might be on a system which doesn't have virtual memory (plenty such systems exist in 64-bit architectures); they might be using calloc on an OS that zeros pessimistically/early; and so on.