Why does the REMOVE method of map container remove elements have memory leaks?

Unfortunately, you can’t remove items from an array while you’re running through a for loop. This is because the indexes get screwed up.

If you double click the for loop, it will open the macro. SAVE THIS AS A COPY, and you can edit that copy to run the loop backwards. It’s ok to remove from an array if you’re running backwards over the elements.

Is this the method you said to remove elements from an array?


I have tested that the memory will continue to grow when the program runs for a long time.

Try saving a temp local reference to found. And do remove first. Use the temp reference for your function and destroy it at the end. Once the function is over and local reference is gone, the memory should be released if that was the last thing referencing it.