Doc: State Qt's out-of-memory policy on the Exception Safety page


The Out of Memory Handling section claims that Qt throws
std::bad_alloc whenever an allocation fails on systems that don't
overcommit memory, and never throws it on systems that do. Neither
is accurate. Qt generally doesn't handle failed allocations at all,
and most Qt modules are built without exception support. Only the
containers that check their allocations with Q_CHECK_PTR throw
std::bad_alloc, and they do so on any system when a request can't
be satisfied, for example when resizing a QByteArray to a very large
size.

The introduction also says that Qt never throws exceptions and uses
error codes instead. Qt mostly reports errors through return values,
error state that callers query afterward, and signals. Qt will even
throw in a few cases, such as std::bad_alloc and the exceptions that
QFuture passes on from Qt Concurrent tasks. There's also a claim that
enabling exceptions increases the library size by more than 20%, a
figure that I couldn't verify.

This change seeks to describe the actual out-of-memory policy,
correct the introduction to describe how Qt reports errors and when
it throws, and drops the size claim.

Fixes: QTBUG-44900
Pick-to: 6.12
Change-Id: Ic9b34cf7a85c2f242cf49bb50b11cedb5b71e3af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
commit8f15b1719da1b371189cc844b5069d4476c14d98
parent04535e6d59ac34ce5251a285b1776492dd916bdb
authorPaul Wicking <paul.wicking@qt.io>
committerPaul Wicking <paul.wicking@qt.io>
commit timeTue, 13 Oct 2026 17:33:03 +0000