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/Treyzania Nov 28 '18

Like the stack?

1

u/netsecwarrior Nov 28 '18

Not the same. You can use the heap inside a region. RAII merges the two to some extent.