free_memory: drop explanatory comment per review

Signed-off-by: liminfei-amd <91481003+liminfei-amd@users.noreply.github.com>
This commit is contained in:
liminfei-amd 2026-06-29 03:08:00 +00:00
parent 7215fc8e34
commit 3711b4d01f

View File

@ -808,10 +808,6 @@ def free_memory(memory_required, device, keep_loaded=[], for_dynamic=False, pins
can_unload = []
unloaded_models = []
# Iterate a snapshot: free_memory can re-enter itself on this thread when a
# weakref finalizer (cleanup_models) fires during GC mid-loop and pops from
# current_loaded_models. Carry the LoadedModel object (not a stale absolute
# index) and remove unloaded entries by identity so a concurrent pop is tolerated.
for shift_model in list(current_loaded_models):
if device is None or shift_model.device == device:
if shift_model not in keep_loaded and not shift_model.is_dead():