[sc-memory] Add iterator references system to safe remove of iterated elements
[sc-memory] Add state checks