Hello,
The script you provided has a theorical misconception, so if it works the way you're implying it does, then the socket design/event is far more broken than just a leak.
In theory, you're reading into a binvar without specifying a number of bytes so a default of 4096 bytes is read into the buffer.
Let's say data arrives on the socket, any data, on sockread triggers, 4096 bytes (or less if less) are read, $sockbr isn't 0.
1) if you have read the full buffer and no more data is available, per the note in the help file under /help /sockread, on sockread won't retrigger in this case, so, certainly not with $sockbr = 0.
2) if you haven't read the full buffer, on sockread retriggers and we're back to reading 4096 or less bytes etc (your on sockread event logic guarantees data is there if the event is triggered)
So it should not be possible for this on sockread event to trigger with $sockbr = 0.
Which version of mIRC are you using, are you using SSL?