# Is there a scheme implementation where the Garbage Collector is built within that Scheme?

**URL:** https://racket.discourse.group/t/is-there-a-scheme-implementation-where-the-garbage-collector-is-built-within-that-scheme/3432
**Category:** Questions & Answers
**Created:** [December 19, 2024, 5:43am UTC](https://racket.discourse.group/t/is-there-a-scheme-implementation-where-the-garbage-collector-is-built-within-that-scheme/3432 "2024-12-19T05:43:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![YongaTechnic](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/yongatechnic/32/2109_2.png) [@YongaTechnic](https://racket.discourse.group/u/YongaTechnic)
#### Post date: [December 19, 2024, 5:43am UTC](https://racket.discourse.group/t/is-there-a-scheme-implementation-where-the-garbage-collector-is-built-within-that-scheme/3432/1 "2024-12-19T05:43:09Z")

</div>

I am looking for a scheme implementation where the garbage collector is not built in a low level system programming language like C, but within the scheme itself?

Can you point me in the right direction?

Thanks

---

<div class="post-metadata">

### Author: ![OldDutchCap](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/olddutchcap/32/2037_2.png) [@OldDutchCap](https://racket.discourse.group/u/OldDutchCap)
#### Post date: [December 20, 2024, 1:39pm UTC](https://racket.discourse.group/t/is-there-a-scheme-implementation-where-the-garbage-collector-is-built-within-that-scheme/3432/2 "2024-12-20T13:39:22Z")

</div>

Not sure if this answers your question or not but:

[https://www.more-magic.net/posts/internals-gc.html](https://www.more-magic.net/posts/internals-gc.html)

I think if you search for Garbage Collection implemented in Scheme you may find some worthwhile results. Just a suggestion, of course.

---

<div class="post-metadata">

### Author: ![bremner](https://avatars.discourse-cdn.com/v4/letter/b/aca169/32.png) [@bremner](https://racket.discourse.group/u/bremner)
#### Post date: [December 20, 2024, 8:56pm UTC](https://racket.discourse.group/t/is-there-a-scheme-implementation-where-the-garbage-collector-is-built-within-that-scheme/3432/3 "2024-12-20T20:56:24Z")

</div>

Yonga Technic via Racket Discourse  
[notifications@racket.discoursemail.com](mailto:notifications@racket.discoursemail.com) writes:

> I am looking for a scheme implementation where the garbage collector is not built in a low level system programming language like C, but within the scheme itself?
> 
> Can you point me in the right direction?

It's not intended for production, but the built-in "#lang plai/gc2"  
teaching languages do support implementing GCs for (a restricted version  
of racket) in racket.

d

---

<div class="post-metadata">

### Author: ![hendrikboom3](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)
#### Post date: [December 20, 2024, 11:01pm UTC](https://racket.discourse.group/t/is-there-a-scheme-implementation-where-the-garbage-collector-is-built-within-that-scheme/3432/4 "2024-12-20T23:01:54Z")

</div>

It wasn't a scheme implementation, but I once wrote a garbage collector  
for Algol 68 in a slightly extended version of Algol 68.

Only possible because Algol 68wa acompiled language and the code  
that the compiler generated for the garbagecollector didn't need  
any garbage collection itself.

I do not know where that code is now

-- hendrik

---

<div class="post-metadata">

### Author: ![jay\_bird](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jay\_bird](https://racket.discourse.group/u/jay_bird)
#### Post date: [December 21, 2024, 1:52am UTC](https://racket.discourse.group/t/is-there-a-scheme-implementation-where-the-garbage-collector-is-built-within-that-scheme/3432/5 "2024-12-21T01:52:40Z")

</div>

Pre-Scheme's gc is written in Pre-Scheme, which is a statically typed restricted dialect of scheme for low level programming. Maybe that'd help?

> **[scheme48](https://codeberg.org/prescheme/scheme48/src/branch/main/scheme/vm)**
>
> A mirror of the Scheme 48 mercurial repositories - https://www.s48.org/

Some background, in case you don't know what pre-scheme and scheme 48 are all about:

[https://prescheme.org/posts/announcing-the-pre-scheme-restoration.html](https://prescheme.org/posts/announcing-the-pre-scheme-restoration.html)
