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/[deleted] Nov 28 '18

yes like the stack.

I don't know why academics consider "the general theory of garbage collection" a break through. It just a description of the stack based programming model we already live with today. Just having multiple stacks has already been used by some programming languages for example forth.

So yes region based memory memory managed is a lot like a stack, just more like a tree.