Quick answer: GameMaker ds_list holding old values after room_restart? Data structures live in global memory; room restart re-creates instances but doesn’t touch your lists.

An ‘active enemies’ ds_list grows over multiple play sessions because room_restart doesn’t clear it.

CleanUp Destroys It

// CleanUp event
if (ds_exists(active_enemies, ds_type_list))
    ds_list_destroy(active_enemies);

CleanUp runs on instance destruction (including room change for non-persistent). Destroys the list before the instance disappears.

Clear vs Destroy

ds_list_clear empties but keeps the list alive. ds_list_destroy frees memory. Pair create / destroy across the instance lifecycle.

Persistent Singletons

For project-wide lists (achievements, settings), put them on a persistent GameManager instance. Don’t recreate on room change.

Use struct/array Instead

GM’s built-in arrays and structs are garbage-collected. Modern code reaches for them first; ds_* is for legacy projects or specific needs.

Verifying

Lists destroy cleanly on room change. No memory growth across many room transitions. Lists scoped correctly to instance lifetime.

“ds_lists aren’t GC’d. Destroy in CleanUp or leak forever.”

Prefer GM arrays / structs for new code — they handle GC automatically and eliminate this entire class of bug.