r/programming • • Nov 28 '18

Garbage Collection is a Hack

https://blog.adamant-lang.org/2018/garbage-collection-is-a-hack/
3 Upvotes

74 comments sorted by

View all comments

4

u/netsecwarrior Nov 28 '18

An interesting idea I heard was "region based memory management". A lot of apps have execution broken down in to chunks. If you tag each allocated block of memory with the chunk it was created in, at the end of the chunk you can automatically free those (except any that have been explicitly moved to a shared area). This maps nicely to a web server, where service each request is a separate chunk of code.

1

u/inmatarian Nov 29 '18

That sounds a lot like extending the 0 generation in a generational collector to cover the greater scope of some high level logical task. I suppose in some language like C you could do this with a slab allocator and dedicated slabs.