From 8d8b3270dcc33bcb910e2a7d401b1054f7d98b00 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Thu, 21 Apr 2022 23:00:42 +0200 Subject: readme: add note about allocator for custom types --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index de889f8..a8abf6d 100644 --- a/README.md +++ b/README.md @@ -451,6 +451,11 @@ Now when you bind a value of type `MyArray` the value returned by `bindField` wi Same for reading, when you select _into_ a `MyArray` row or field the value returned by `readField` will be used instead. +_NOTE_: when you _do_ allocate in `bindField` or `readField` make sure to pass a `std.heap.ArenaAllocator`-based allocator. + +The binding or reading code does not keep tracking of allocations made in custom types so it can't free the allocated data itself; it's therefore required +to use an arena to prevent memory leaks. + # Comptime checks Prepared statements contain _comptime_ metadata which is used to validate every call to `exec`, `one` and `all` _at compile time_. -- cgit v1.2.3