benilla-re systems structs docs

luaC_sweep

function · lua · boundary

Address
0x6f71d0 · 55 bytes, up to 0x6f7206
Meaning
Sweeps the userdata list, the string table and the main list, freeing everything when asked
Confidence
verified, proof one
Name from
the community database (idb)
Finding
lua/runtime#sweeping-and-finalizers

Finding: Sweeping and finalizers in lua: calls, states and the collector

A collection frees what is unmarked. luaC_sweep sweeps the main list and every string bucket (sweepstrings) with sweeplist, which frees an unmarked object through freeobj by its tag and clears the mark of a survivor. luaC_callGCTM calls the __gc metamethods of the userdata set aside for finalizing, one at a time through do1gcTM, with hooks off. checkSizes halves an oversized string table and work buffer, and then sets the next threshold in a function the client added. luaC_link puts a new object on the main list with a tag and clear marks.

functionnamedecided by
0x6f7080luaC_callGCTMhooks off (0x6f7099), each userdata moved to the main list (0x6f70aa), do1gcTM (0x6f70da)
0x6f7120do1gcTMno-tag-method flag test (0x6f712a), luaT_gettm (0x6f7146), luaD_call (0x6f71bd)
0x6f71d0luaC_sweeplimit 0x100 for the free-all argument (0x6f71da), sweeplist (0x6f71e8), sweepstrings (0x6f71f1), sweeplist (0x6f71ff)
0x6f7210sweeplistmark byte against the limit (0x6f7229), low mark bit of a survivor cleared (0x6f722e), freeobj (0x6f723e)
0x6f7260freeobjtag test (0x6f7267): proto 0x6fa050 (0x6f7273), closure 0x6fa110 (0x6f7278), table 0x6fa690 (0x6f7291), thread 0x6f6c90 (0x6f7296)
0x6f72f0sweepstringssweeplist per bucket (0x6f7317), string count lowered by the freed number (0x6f731c)
0x6f7370checkSizesstring count under a quarter and size over 64 (0x6f738c), luaS_resize (0x6f739c), buffer realloc in lgc.c (0x6f73c1), tail jmp to the threshold update (0x6f73d6)
0x6f7b20luaC_linkold head stored in the object (0x6f7b29), object stored in [G+0x10] (0x6f7b31), mark 0 (0x6f7b34), tag from the argument (0x6f7b38)

The derivation is in the doc.

Callers 2

Callees 2

Calls and jumps by a bare address, from tables/calls.tsv.