You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--- Releases the already used Lua table, `tb`, into the table pool named `pool_name`. If the specified table pool does not exist, create it right away.
5
+
---
6
+
--- The caller must *not* continue using the released Lua table, `tb`, after this call. Otherwise random data corruption is expected.
7
+
---
8
+
--- The optional `no_clear` parameter specifies whether to clear the contents in the Lua table `tb` before putting it into the pool. Defaults to `false`, that is, always clearing the Lua table.
9
+
---
10
+
--- If you always initialize all the elements in the Lua table and always use the exactly same number of elements in the Lua table, then you can set this argument to `true` to avoid the overhead of explicit table clearing.
11
+
---
12
+
--- According to the current implementation, for maximum 200 Lua tables can be cached in an individual pool. We may make this configurable in the future. If the specified table pool already exceeds its size limit, then the `tb` table is subject to garbage collection. This behavior is to avoid potential memory leak due to unbalanced `fetch` and `release` method calls.
13
+
---
14
+
---@parampool_namestring
15
+
---@paramtbtable
16
+
---@paramno_clearboolean
17
+
functiontablepool.release(pool_name, tb, no_clear) end
18
+
19
+
--- Fetches a (free) Lua table from the table pool of the specified name `pool_name`.
20
+
---
21
+
--- If the pool does not exist or the pool is empty, simply create a Lua table whose array part has `narr` elements and whose hash table part has `nrec` elements.
22
+
---
23
+
---@parampool_namestring
24
+
---@paramnarrnumber size of the array-like part of the table
25
+
---@paramnrecnumber size of the hash-like part of the table
26
+
---@returntable
27
+
functiontablepool.fetch(pool_name, narr, nrec) end
0 commit comments