A number of ExtCore functions, e.g., those in the Seq module, call GetEnumerator() on a seq<'T> but don't dispose the resulting enumerator. This is a problem, because the enumerator can (for example) hold handles to unmanaged resources, which are leaked when the enumerator isn't disposed properly.
The first step to fixing these issues will be to implement a custom IEnumerable<T> type in ExtCore.Tests; when GetEnumerator() is called on this type, it should return an instance of IEnumerator<T> that captures a ref cell stored inside the parent and is incremented when GetEnumerator() is called and decremented when the enumerator is disposed. This way, unit tests can assert that allocated enumerators have been disposed.
A number of ExtCore functions, e.g., those in the
Seq
module, callGetEnumerator()
on aseq<'T>
but don't dispose the resulting enumerator. This is a problem, because the enumerator can (for example) hold handles to unmanaged resources, which are leaked when the enumerator isn't disposed properly.The first step to fixing these issues will be to implement a custom
IEnumerable<T>
type in ExtCore.Tests; whenGetEnumerator()
is called on this type, it should return an instance ofIEnumerator<T>
that captures a ref cell stored inside the parent and is incremented whenGetEnumerator()
is called and decremented when the enumerator is disposed. This way, unit tests can assert that allocated enumerators have been disposed.