Also not sure why people like coming with analogies so much, they very rarely are useful or make anything clearer.
Like in this case, the situation you describe is exactly what a garbage collected language does, the key is that they let you mark what memory is still in use with a reference. Similarly in this case, there should be an explicitly defined time with a rule that if police want to hold something longer, they need to actively justify why and what the expected timeline is for the return without the owner needing to take them to court over it. Not perfect, but neither is garbage collection, and to me sounds much improved from what we've got.
The topic at hand is pretty straightforward and easy to understand, not sure what’s the point of trying to explain it using significantly more complex concepts besides making it more confusing and harder to understand for no reason.. (I mean I find it hard to believe that any person who understands how GC works would find the analogy in anyway useful).
> Not always easy to find one that fits perfectly but usually it just needs a bit of a tweak.
On a very superficial level sure. But then that mechanism starts coming apart at the seems if you start talking about the details.
Why not? It would seem that you're just used to a state of exploitation and selective application, both of which are a mockery of justice. Sometimes it helps to see things from an outsider's perspective.
And if you're saying that this ruling is bad because it doesn't work well in an idealized model of the law as you think it should be... that's an interesting observation, but you can hardly fault the judge for crafting a ruling that works in the context of the actual legal system.
Take warrants and probable cause. It's supposed to be that by a preponderance of the evidence that the crime has been committed. The quality of many warrants today seem to completely miss this to the point that many of the descriptions fail to even claim that the elements of the offense have been satisfied. Then we have such a lazy system that warrants foe summary offenses don't even have to be for the correct crime - all that needs to be claimed is that any crime has been committed. That's how it goes when the system is too lazy to give each issue the correct level of attention to protect your basic rights.
There are no hard promises about when or even whether GC will reclaim a particular piece of garbage, precisely to enable optimizations and necessary compromises. Application availability is often more important than immediately collecting every possible piece of garbage. The use of tagging, generations, arenas, etc. all allow the GC to use heuristics and apply different collection regimes to different pieces of garbage.
But, different implementations of the same language and different versions of those implementations can all do different things. GC rarely says exactly when something will be collected. Only that it will eventually.
Example: https://jsfiddle.net/8cej4tpk/2/
Firefox GCs after about 8 seconds, Safari GCs immmediately, Chrome never (probably not until there's pressure). And, you'll find different behavior if you go check different versions of those browsers.
This is essentially what Python-the-language does. It does not require reference counting, or mark-sweep, or any garbage collection at all. The language specification says at https://docs.python.org/3/reference/datamodel.html#objects-v... :
"Objects are never explicitly destroyed; however, when they become unreachable they may be garbage-collected. An implementation is allowed to postpone garbage collection or omit it altogether — it is a matter of implementation quality how garbage collection is implemented, as long as no objects are collected that are still reachable."
That subjective language specification is quite different than its objective implementation in a Python implementation, which appear to be what you refer to now.
They give programs a reasonable amount of memory, without getting into specifics about the limits. And they reclaim memory as necessary based on the demands of the OS and other programs. See, for example, browser memory usage vs video game usage.
It turns out that in practice "reasonable" works quite well as long as you are reasonable about it.