luaH_free
function · lua · boundary
- Address
0x6fa690· 104 bytes, up to0x6fa6f7- Meaning
- Frees the node vector, the array and the record of a table
- Confidence
- verified, proof two
- Finding
- lua/object#table-creation-and-growth
Finding: Table creation and growth in lua: objects and tables
luaH_new makes a table: a 32-byte record with the default metatable, no array and no node
vector, then sized by setarrayvector and setnodevector. setnodevector raises table overflow above 2^24 nodes, uses the shared dummy node for a log size of 0, and otherwise allocates 40
bytes a node, all nil. rehash counts the live keys (numuse, which fills a count per power
of two) and picks the sizes with computesizes: the largest array part at least half full.
resize moves the entries into the new vectors and luaH_free frees a table.
| function | name | decided by |
|---|---|---|
0x6fa4f0 | luaH_new | allocates 0x20 bytes (0x6fa50a), luaC_link type 5 (0x6fa517), flags 0xff (0x6fa52c), setarrayvector (0x6fa53c), setnodevector (0x6fa549) |
0x6fa560 | setarrayvector | reallocates size*16 in ltable.c (0x6fa584), new slots set to tag 0 |
0x6fa5d0 | setnodevector | limit 24 (0x6fa5e2), table overflow (0x6fa5e9), dummy node [G+0x58] for size 0 (0x6fa601), 40 bytes a node (0x6fa620) |
0x6fa690 | luaH_free | three luaM_irealloc calls in ltable.c (0x6fa6bc, 0x6fa6d9, 0x6fa6f0), the first only for a nonzero node size |
0x6fa9c0 | rehash | numuse (0x6fa9d5), luaO_log2 (0x6fa9dd), resize (0x6fa9ec) |
0x6faa00 | numuse | slice loop to 24 (0x6faa67), arrayindex (0x6faab6), luaO_log2 (0x6faac2), computesizes (0x6faae7) |
0x6fab00 | computesizes | #choosing-the-array-size |
0x6fab90 | resize | setarrayvector (0x6fac1f), setnodevector (0x6fac2f), luaH_setnum (0x6fac63), luaH_set (0x6facfd), old vector freed (0x6fad5e) |
The derivation is in the doc.
Callers 1
- freeobj lua
Callees 1
- luaM_irealloc lua
Calls and jumps by a bare address, from tables/calls.tsv.