Boost logo

Boost :

Subject: Re: [boost] variant2 never empty guarantees
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-06-09 06:26:09


On 9/06/2017 18:09, degski wrote:
> On 9 June 2017 at 02:05, Gavin Lambert wrote:
>
>> ... since assignment is not really expected to throw for any reason other
>> than out of memory.
>>
>
> Are there really any modernish OSes that *do* run out of memory? Stack
> space (on those type of machines) maybe, but now we are talking programming
> error, I would say, because that situation is foreseeable (and should be
> expected) by the programmer.
It's not particularly hard for certain application types to run out of
memory (or at least address space) on 32-bit platforms.

I suppose you could argue (with some justification) that those are not
"modern", but at least in the Windows world it's still fairly common for
applications to be 32-bit (even when the OS is almost exclusively 64-bit
now) until they actually prove they need more memory. It's also not
uncommon for applications to have memory leaks that inevitably end in
out of memory errors if left long enough.

And some people religiously disable swap, which can have a similar result.

> From what I understand, if one is programming for embedded systems or
> iot-devices, dynamic allocation is not the common way to do things
> and all memory required is allocated upon boot.
Depends on the type of application. For tiny embedded IoT devices,
sure. For larger ones that are basically just a PC running a kiosk app,
dynamic allocation is not uncommon. There's a broad spectrum in between.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk