GMS 2 Why Does the first ds_map created have the index 2?

I stumbled across this weird thing:
I only have one object oData
in the create event I create a ds_map nothing more
Code:
map = ds_map_create();
now when I open the debuggin tool it tells me that there is one object oData which has a ds_map with the index 2

so when I restart the game by pressing the space bar
Code:
ds_map_destroy(map);
game_restart();

the index of the ds_map is suddenly 0 as it should be. right? why are there two mysterious ds_maps? am I missinterpreting something?

[EDIT] any idea why the images are not shown?
 
You shouldn't rely on IDs outside of runtime. Meaning, in your code you shouldnt be calling an object by it's specific Id, only ever by a variable referencing the object after it's created, if that makes sense. You can't rely on objects having a constant Id so keep that in mind.
 
You shouldn't rely on IDs outside of runtime. Meaning, in your code you shouldnt be calling an object by it's specific Id, only ever by a variable referencing the object after it's created, if that makes sense. You can't rely on objects having a constant Id so keep that in mind.
Yes, I know. But I use these IDs at the beginning to make shure that I do not create a memory leak.
Yesterday I spent almost an hour looking for the memory leak because of this weird starting index until I found it there is none.
 

kupo15

Member
Yes, I know. But I use these IDs at the beginning to make shure that I do not create a memory leak.
Yesterday I spent almost an hour looking for the memory leak because of this weird starting index until I found it there is none.
Did you also create other ds_types before this one? It would make sense that each DS has its own numbering system but I'm pretty sure they all share the same indexing? I could definitely be totally wrong. I remember debugging an issue where it said "error with grid 10" or something like that and I definitely have more than just grids. I'm pretty sure I didn't have 10 grids though and when I counted through all the ds_creates it lined up. I'm fuzzy on the details with this but give that a check
 
Did you also create other ds_types before this one? It would make sense that each DS has its own numbering system but I'm pretty sure they all share the same indexing? I could definitely be totally wrong. I remember debugging an issue where it said "error with grid 10" or something like that and I definitely have more than just grids. I'm pretty sure I didn't have 10 grids though and when I counted through all the ds_creates it lined up. I'm fuzzy on the details with this but give that a check
No, I created only a whole new project to make shure there are no other DS. and then I only created one ds_map. which was the only thing which happened in the project still got an index of 2 at the beginning.
 

TsukaYuriko

šŸŒ 
Forum Staff
Moderator
Did you also create other ds_types before this one? It would make sense that each DS has its own numbering system but I'm pretty sure they all share the same indexing?
Data structures do have separate IDs per type, much to the dismay of anyone who has ever accidentally used list functions when they intended to use grid functions, or any other combination of data structure types.



@31Nf4ChZ4H73N (thank Theoxidos for @mention autocomplete!):
The ID of the first map I create in my test project is 0... outside of debug mode. If I start it in debug mode, it's 2.

The other two maps are probably internally-created ones used to store debug information.
 

kupo15

Member
Data structures do have separate IDs per type, much to the dismay of anyone who has ever accidentally used list functions when they intended to use grid functions, or any other combination of data structure types.



@31Nf4ChZ4H73N (thank Theoxidos for @mention autocomplete!):
The ID of the first map I create in my test project is 0... outside of debug mode. If I start it in debug mode, it's 2.

The other two maps are probably internally-created ones used to store debug information.
I didn't think I was correct haha yours makes complete sense! =)
 
Top