.
This commit is contained in:
parent
5477252c23
commit
640519a5fa
1 changed files with 5 additions and 7 deletions
12
STYLEGUIDE
12
STYLEGUIDE
|
|
@ -134,10 +134,9 @@ Memory Management
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
If a custom type needs dynamically allocated memory to
|
If a custom type needs dynamically allocated memory to
|
||||||
function, it should always assume the memory it requested
|
function, it should always assume the memory came from an
|
||||||
came from an arena allocator. This means it is the
|
arena allocator. This means it is the responsibility of
|
||||||
responsibility of the arena to free the memory, not the
|
the arena to free the memory, not the custom data type.
|
||||||
custom data type.
|
|
||||||
|
|
||||||
In other words:
|
In other words:
|
||||||
|
|
||||||
|
|
@ -145,9 +144,8 @@ Do *not* add procedures that 'free' or 'delete' the memory
|
||||||
allocated by the data type.
|
allocated by the data type.
|
||||||
|
|
||||||
Instead, add procedures that 'reset' the data type,
|
Instead, add procedures that 'reset' the data type,
|
||||||
allowing the already allocated memory to be reused. For
|
allowing its memory to be reused. For examples, see
|
||||||
examples, see the 'reset' procedures in 'jc/kv'
|
the 'reset' procedures in 'jc/kv' or 'jc/array'.
|
||||||
or 'jc/array'.
|
|
||||||
|
|
||||||
|
|
||||||
OS-Specific Code
|
OS-Specific Code
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue