Refined description of what happens when you call init multiple times

The original note was misleading in that it implied an actual memory leakage (in the common sense of the term). This is not the case though since the memory is left as dead space in the message but is always correctly freed upon freeing the arena.
This commit is contained in:
Fabian Hachenberg
2020-02-13 22:43:54 +01:00
committed by GitHub
parent 432123edd4
commit e914dc8251

View File

@@ -98,7 +98,7 @@ For now, let's grab the first element out of this list and assign it to a variab
alice = people[0]
.. note:: It is a very bad idea to call `init` more than once on a single field. Every call to `init` allocates new memory inside your Cap'n Proto message, and if you call it more than once, the previous memory is leaked.
.. note:: It is a very bad idea to call `init` more than once on a single field. Every call to `init` allocates new memory inside your Cap'n Proto message, and if you call it more than once, the previous memory is left as dead space in the message. See `https://capnproto.org/cxx.html#tips-and-best-practices <Chapter about Tips and Best Practices> for more details`_.
Primitive Types
~~~~~~~~~~~~~~~~~~~~~~~~~~~