Sorry, I was mislead by the Debug feature losing track of all the references... I assumed they were automatically freed, because their references and all the content disappear when I change room. Good to know they aren't.
The variable that was indexing the ds_list indeed disappears, however the content does not.
Yeah, so what happens is, when you create a ds_list for example, you get in return an integer id that you need to keep track of.
e.g. :
my_list = ds_list_create() // my_list now equals 0 ( for example ).
So now, we have a ds_list floating around in memory that GMS is keeping track of internally, and which you can access using the id/index of 0.
So you could now actually write:
ds_list_add(0, "some_data")
and it will add it to the list that you created above.
Let's say the variable my_list was in an instance that you created in room0, and then you moved to room1 and the instance was destroyed, along with its variable "my_list". It appears as if you have lost track of the DS...and maybe it has been destroyed....but wait...
NOTE : The important bit is, even if the variable holding the id of the data structure is destroyed, the data structure is still in memory, and can even be re-accessed if you still know what its id was.
The data structure still exists, and you can still access it with the id of 0.
You could even assign the number 0 to new variable, then use that new variable to access the list.
my_old_list = 0
ds_list_add(my_old_list, "some_more_data")
OR
my_old_list[| 0] = "replace some data at position 0 in list"
NOTE 2:
Think of the data structure id that you get when you create a ds_list as an "index" ( a simple integer number ) as opposed to a pointer or a reference (if you are coming from a non-memory managed language like C/C++).
The DS exists independently of the variable that is holding the index.
It's like if I asked for your home address, and you wrote it down for me on a piece of paper. (The address is the index to the DS, the piece of paper is the variable holding that index)
If I throw that piece of paper away, your house still exists. The variable and the index have gone, but your house (the DS) is certainly still there.