Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thehxdev/cgc
A simple and tiny garbage collector in C for C
https://github.com/thehxdev/cgc
Last synced: 13 days ago
JSON representation
A simple and tiny garbage collector in C for C
- Host: GitHub
- URL: https://github.com/thehxdev/cgc
- Owner: thehxdev
- Created: 2023-07-30T21:15:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-13T13:34:38.000Z (about 1 year ago)
- Last Synced: 2024-11-14T04:24:18.004Z (2 months ago)
- Language: C
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CGC
A simple and tiny garbage collector in C for C :)
I wrote it in probably 1 or 1.5 hours so it's not a big deal and not ment to be used
in other projects. It's only a hubby side project to practice how to implement a simple
GC in C programming language with my own understanding of memory and data structures without
reading any paper or documentation about automatic memory management or garbage collectors.## How it works
It's only a wrapper for `malloc` and `calloc` functions to store allocated
memory chunkes in a doubly-linked-list to keep track of them.then at the end of `main` function user must call `gc_freeAll` function to
free all of the allocated memory on the Heap.## Problems
- It only triggers GC at the end of `main` function
- Bad code design with so much duplicated code (maybe solvable with macros)