Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions engine_details/architecture/core_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,21 @@ scripting API.
.. |typed_dictionary| replace:: `TypedDictionary <https://github.com/godotengine/godot/blob/master/core/variant/typed_dictionary.h>`__
.. |pair| replace:: `Pair <https://github.com/godotengine/godot/blob/master/core/templates/pair.h>`__

Relocation safety
^^^^^^^^^^^^^^^^^

Godot's containers assume their elements are `trivially relocatable <https://open-std.org/JTC1/SC22/WG21/docs/papers/2020/p1144r5.html>`__.

This means that, if you store data types in it that have pointers to themselves, or are otherwise
`not trivially relocatable <https://open-std.org/JTC1/SC22/WG21/docs/papers/2020/p1144r5.html#non-trivial-samples>`__,
Godot might crash. Note that storing **pointers to** objects that are not trivially relocatable, such as some Object
subclasses, is unproblematic and supported.

The reason to assume trivial relocatability is that it allows us to make use of important optimization techniques, such
as relocation by ``memcpy`` or ``realloc``.

`GH-100509 <https://github.com/godotengine/godot/issues/100509>`__ tracks this decision.

.. _doc_core_concurrency_types:

Multithreading / Concurrency
Expand Down
Loading