This PR correctly triggers writing the in-memory buffer to disk when the number of entries reached the max-memory limit, the previous code when checking that the capacity of the entries buffer reached the threshold, unfortunately, the capacity was never shrunk and therefore the system was always triggered, at ever insert.
Note that the entries buffer capacity represents the real amount of memory consumed by the sorter, using the length of it is kind of wrong, but the amount of memory represented by the length doesn't outfit the max-memory by far compared to the capacity.
This PR closes #1 that is fixing an imaginary bug.
This PR correctly triggers writing the in-memory buffer to disk when the number of entries reached the max-memory limit, the previous code when checking that the capacity of the entries buffer reached the threshold, unfortunately, the capacity was never shrunk and therefore the system was always triggered, at ever insert.
Note that the entries buffer capacity represents the real amount of memory consumed by the sorter, using the length of it is kind of wrong, but the amount of memory represented by the length doesn't outfit the max-memory by far compared to the capacity.
This PR closes #1 that is fixing an imaginary bug.