https://github.com/economicmodeling/containers/blob/master/src/containers/dynamicarray.d#L72 Does this work? You try to remove new range instead of old one. Also you should remove old range only after you added new range, so that GC won't catch you in the middle.