Markus Mottl  committed 97b35f0

Reverted recent async writer space usage bug

  • Participants
  • Parent commits a5ca923
  • Branches default

Comments (0)

Files changed (1)

File base/async/scheduler/lib/

     (t.buf, pos)
   end else begin
     (* Preallocated buffer too small; schedule buffered writes *)
-    if desired > buf_len then begin
+    (* We have to divide the buffer length by two in the following comparison
+       to avoid wasting buffer space on subsequent writes of slightly more
+       than half the buffer length. *)
+    if desired > buf_len / 2 then begin
       schedule_unscheduled t `Keep;
       (* Preallocation size too small; allocate dedicated buffer *)
       let buf = Bigstring.create desired in