diff options
author | Pekka Paalanen <pekka.paalanen@collabora.com> | 2022-07-20 13:01:13 +0300 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.com> | 2022-07-20 13:07:22 +0300 |
commit | 9358706743c208e2fd0f36bea5a3f45f91fa58c9 (patch) | |
tree | edd0aa7460e1ed3e0c0d292db2cd2972407d1387 /README.md | |
parent | fc26c749dfae47e5b4f81ad38760e3e7585b3216 (diff) |
README: establish no-malloc-failures policy
There are many reasons why trying to handle malloc() returning NULL by
any other way than calling abort() is not beneficial:
- Usually malloc() does not return NULL, thanks to memory overcommit.
Instead, the program gets SIGSEGV signal when it tries to access the
memory.
- Trying to handle NULL will create failure paths that are impractical
to test. There is no way to be sure the compositor still works once
such path is actually taken.
- Those failure path will clutter the code, increasing maintenance and
development burden.
- Sometimes there just isn't a good way to handle the failure.
For more discussion, see the issue link below.
Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/631
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -18,6 +18,12 @@ bugs and shortcomings, we avoid unknown or variable behaviour as much as possible, including variable performance such as occasional spikes in frame display time. +Weston and libweston are not suitable for memory constrained environments +where the compositor is expected to continue running even in the face of +trivial memory allocations failing. If standard functions like `malloc()` +fail for small allocations, +[you can expect libweston to abort](https://gitlab.freedesktop.org/wayland/weston/-/issues/631). + A small suite of example or demo clients are also provided: though they can be useful in themselves, their main purpose is to be an example or test case for others building compositors or clients. |