How does the garbage collector actually work?

Hey guys, I’m confused how the garbage collector actually works in Nomad.

For some more context, I’m trying to retain allocations so that debugging is easier if a deployment goes bad. However, some allocations seems to be collected sooner then I expected.

I’ve been monitoring the logs related to garbage collecting but all reasons so far have been ‘forced collection’. I can’t really make heads or tails of it

I’ve set the limits for every client to it’s maximum, so (normally) that shouldn’t be the issue.

My main questions are;

  • When are allocations marked as garbage and when are they collected?
  • What would be the best way of changing this behavior?