Jam373
Member
So I learnt the hard way that ds_exists has issues. I have a function that creates data structures, that I call several times in different contexts. Mosts of those contexts have the data structures destroyed as soon as the function is finished. One of them however "requires" (I could work around if necessary) the function to run several times before destroying the DSs. So I thought I'd change the function to only create the DSs if they don't already exist via ds_exists, but it turns out as I'm sure many of you are aware that if the variable storing the id has been previously used for the DS, even if destroyed, ds_exists will return true.
Anyway, long preamble, probably not needed but whatever. Instead I've opted for keeping my function as it was previously and just recreating the DSs everytime the function is called. Everything works as normal. However I have concerns that recreating DSs that already exist causes a memory leak. That the old DSs lose their "identifier" and are lost to the ether, being replaced by the new ones but still taking up memory. Am I correct? I know what to do to fix it if this is the case but I just want to know if that is or isn't happening.
Anyway, long preamble, probably not needed but whatever. Instead I've opted for keeping my function as it was previously and just recreating the DSs everytime the function is called. Everything works as normal. However I have concerns that recreating DSs that already exist causes a memory leak. That the old DSs lose their "identifier" and are lost to the ether, being replaced by the new ones but still taking up memory. Am I correct? I know what to do to fix it if this is the case but I just want to know if that is or isn't happening.
Last edited: