@@ -103,18 +103,25 @@ which are equivalent to new, delete, new[] and delete[].
103103memnew/memdelete also use a little C++ magic and notify Objects right
104104after they are created, and right before they are deleted.
105105
106- For dynamic memory, use Godot's ``Vector<> `` or one of its variations.
107- Godot's ``Vector<> `` behaves much like an STL ``Vector<> ``, but is simpler,
108- thread safe, and uses Copy-On-Write semantics.
109- It can be safely passed via public API.
110-
111- The ``Packed*Array `` :ref: `types <doc_gdscript_packed_arrays >` are aliases for
112- specific ``Vector<*> `` types (e.g., ``PackedByteArray ``, ``PackedInt32Array ``)
113- that are accessible via GDScript. Prefer using the ``Packed*Array `` aliases
114- when available.
115-
116- ``LocalVector<> `` is a non-COW version, with less overhead. It is intended for
117- internal use where the benefits of COW are not needed.
106+ For dynamic memory, use one of Godot's sequence types such as ``Vector<> ``
107+ or ``LocalVector<> ``. ``Vector<> `` behaves much like an STL ``Vector<> ``,
108+ but is simpler and uses Copy-On-Write (CoW) semantics. CoW copies of
109+ ``Vector<> `` can safely access the same data from different threads, but
110+ several threads cannot access the same ``Vector<> `` instance safely.
111+ It can be safely passed via public API if it has a ``Packed `` alias.
112+
113+ The ``Packed*Array `` :ref: `types <doc_gdscript_packed_arrays >` are aliases
114+ for specific ``Vector<*> `` types (e.g., ``PackedByteArray ``,
115+ ``PackedInt32Array ``) that are accessible via GDScript. Outside of core,
116+ prefer using the ``Packed*Array `` aliases for functions exposed to scripts,
117+ and ``Vector<> `` for other occasions.
118+
119+ ``LocalVector<> `` is much more like ``std::vector `` than ``Vector<> ``.
120+ It is non-CoW, with less overhead. It is intended for internal use where
121+ the benefits of CoW are not needed. Note that neither ``LocalVector<> ``
122+ nor ``Vector<> `` are drop-in replacements for each other. They are two
123+ unrelated types with similar interfaces, both using a buffer as their
124+ storage strategy.
118125
119126References:
120127~~~~~~~~~~~
0 commit comments