Are there any programming languages/runtimes/frameworks with a "garbage collection" strategy of just never collecting any garbage? (During program execution; obviously the memory would be freed when the process exited)

It wouldn't work for _most_ use cases, but for extremely short lived programs (e.g. CLI scripts) it seems like this would be an easy way to avoid the stop-the-world costs of a GC without any memory safety risks.

Does this exist? Or am I missing some reason it'd be dumb?

@codesections HotSpot JVM also has a noop GC ( for, likewise, short-lived programs (even though the startup cost is unlikely to make that an attractive first choice.)

Not sure many consider PHP particularly worthy of discussion, but even though it's reference counted by default, the cycle collector can be toggled when needed:
Same (in both regards) applies to Python too:

So perhaps it's more common than it may seem at first?



> So perhaps [a noop GC for short-lived programs is] more common than it may seem at first?

Yeah, that's my overall takeaway from the many interesting examples people have brought up in the replies!

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.