summaryrefslogtreecommitdiffstats
path: root/glob.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-11-08 20:04:31 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-11-08 20:04:31 -0800
commit05243452efd861e872a6d5c612c23a2cdea86ec5 (patch)
treee28cc1881df53c94c7df3577b795c4e3e451f2b9 /glob.c
parente8a6f437306d6e6dc3576a47181aad3a2b741f2b (diff)
downloadtxr-05243452efd861e872a6d5c612c23a2cdea86ec5.tar.gz
txr-05243452efd861e872a6d5c612c23a2cdea86ec5.tar.bz2
txr-05243452efd861e872a6d5c612c23a2cdea86ec5.zip
gc: free heaps that become empty.
On glibc, our heap allocation requests are considered large and handled via mmap; when we free a heap, the memory is returned to the OS via munmap. * gc.c (sweep): If every object in a heap is freed, we free the entire heap, taking care to also reset the free list to the state before those objects were added to it. The free list may still contain objects from that same heap that were not just added to it (they were freed in a previous GC pass), so we must walk the free list to find the remaining objects and remove them. The Valgrind debugging logic (opening access and closing while walking the list) was too cumbersome so it's done in two passes: open access to the whole free list, process it, close off what is left.
Diffstat (limited to 'glob.c')
0 files changed, 0 insertions, 0 deletions