cyclone/srfi
yorickhardy 71e5aa2dd6
Improve garbage collection for terminated threads (#550)
* gc: add a function to force the collector to run

This requires adding a "forced" stage for the collector,
which is the initial stage for a forced collection.
Thereafter, the collector continues to the usual stages
of collection.

* runtime: force the garbage collector to run when a thread exits

This is a first attempt to improve the memory usage reported in
issue #534.

* srfi-18: call Cyc_end_thread on thread exits

This ensures that the collector has a chance to run whenever
a thread exits. Attempts to partially address issue #534.

* gc: free unused parts of the heap before merging

When a thread exits, the heap is merged into the main thread.
Before doing so, free any unused parts of the heap to reduce
memory usage. Attempts to partially address issue #534.

* srfi-18: thread-terminate! takes a thread as argument

* gc: revert adding STAGE_FORCING

Use gc_start_major_collection() instead. Partial work towards
addressing issue #534.

* gc: free empty pages in gc_heap_merge()

Moving the code from gc_merge_all_heaps to gc_heap_merge removes
special handling of the start of the list and is (hopefully)
easier to read.

Partial work towards addressing issue #534.

* gc: oops, forgot the "freed" count

Partial work towards addressing issue #534.

* gc: oops, forgot the "freed" count (again)

Partial work towards addressing issue #534.

* types: update forward declaration of gc_heap_merge()

Partial work towards addressing issue #534.

* gc: remove accidental double counting

* runtime: small (cosmetic) simplification

* srfi-18: add a slot for thread context in the thread object

Partial work towards addressing issue #534.

* srfi-18: do a minor gc when terminating a thread

This ensures that any objects which are part of the
thread context are transferred to the heap.

Partial work towards addressing issue #534.

* types.h: make gc_alloc_pair public

This will be used to create the thread context.
Partial work towards addressing issue #534.

* gc: prepare heap objects for sweeping

Also introduce a global variable to track whether merged
heaps need to be swept.

Partial work towards addressing issue #534.

* gc: create a context for terminated thread objects

The context ensures that parametrised objects, continuations
and exception handlers can still be traced but are no longer
root objects (after thread terminations) and can be GCd eventually.

Partial work towards addressing issue #534.

* gc: sweep and free empty heaps for the primordial thread

The primordial thread may not have an opportunity to sweep
heap pages which have been merged from terminated threads.
So sweep any unswept pages during the cooperation phase.

Partial work towards addressing issue #534.

* srfi-18: revert thread-terminate! changes

These changes need to be revisited, and are not suitable for
the threads garbage collection pull request.
2025-01-20 21:10:49 -05:00
..
comparators Initial file 2020-09-30 13:01:31 -04:00
list-queues Relocated test library 2019-06-19 18:29:42 -04:00
sets Relocated test library 2019-06-19 18:29:42 -04:00
sorting Add additional SRFI 132 functions 2020-09-03 19:02:41 -04:00
vectors Relocated test library 2019-06-19 18:29:42 -04:00
1.scm No need to repeat member/assoc here 2016-08-19 23:20:31 -04:00
1.sld Explicit inlines 2017-04-29 01:18:39 +00:00
2.scm Initial file 2016-08-20 03:16:10 -04:00
2.sld cleanup, cut over to (srfi x) 2016-08-20 18:00:55 -04:00
18.sld Improve garbage collection for terminated threads (#550) 2025-01-20 21:10:49 -05:00
27.sld Issue #326 - Use timer to seed pseudorandom numbers 2019-07-24 13:19:38 -04:00
28.scm Adding full support for SRFI 28, adding tests for compliance, modifying changelog 2017-02-05 14:01:31 +13:00
28.sld Adding full support for SRFI 28, adding tests for compliance, modifying changelog 2017-02-05 14:01:31 +13:00
60.scm Fix libtommath warnings 2019-10-23 13:24:13 -04:00
60.sld Removing all need for (scheme inexact) 2017-02-10 17:59:08 +13:00
69.sld Handle hashing of complex nums with a 0i component 2019-02-19 13:20:29 -05:00
106.sld Define *ai-v4mapped* to zero on platforms where AI_V4MAPPED is undefined. 2024-03-05 22:18:44 +02:00
111.sld Added SRFI 111 2016-08-24 00:31:50 -04:00
113.sld Renamed 113 library 2016-11-29 17:04:01 -05:00
117.sld Initial file 2016-09-06 23:08:31 -04:00
121.scm Adding SRFI 121 support, tests, all tests pass 2017-02-08 22:23:36 +13:00
121.sld Adding SRFI 121 support, tests, all tests pass 2017-02-08 22:23:36 +13:00
128.sld Issue #414 - Include SRFI 162 defs 2020-09-30 13:06:59 -04:00
132.sld Add additional SRFI 132 functions 2020-09-03 19:02:41 -04:00
133.sld Explicit inlines 2017-04-29 01:18:39 +00:00
143.sld Issue #519 - Fix fxlength 2024-01-08 19:00:39 -08:00
README.md New file 2019-05-17 12:37:16 -04:00
test-1.scm Initial files 2016-08-19 23:04:50 -04:00
test-2.scm Initial file 2016-08-20 03:16:10 -04:00
vectors-impl.scm Relocated scm file 2016-08-22 18:28:14 -04:00

This directory contains the SRFI libraries provided by Cyclone.