Because you used uint instead of ubyte, array is bigger, memory exhausts faster.
Oh, I see.

3. Why it helps?
GC.free(data.ptr);

Initial leak happened because for some reason array allocated in previous iteration was not collected by GC when allocating new one, so the new one was allocated in another space growing the heap. If you place GC.free the array gets removed from heap on each iteration and each new allocation reuses the same memory, heap doesn't grow.
If we do this manually it's works, but automatically is broken?

Reply via email to