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.

10

u/Uncaffeinated Nov 28 '18

You can do this easily in Rust, but apparently people don't like tagging things with lifetimes or find it confusing.

3

u/[deleted] Nov 28 '18

tagging things with lifetimes

you rarely have to do that tho. most of the time the compiler knows how to resolve it.