From: Yohanes Santoso Date: 2006-02-01T06:07:58+09:00 Subject: Re: PATCH: append option to sysread -- retracted Tanaka Akira writes: > In article <87bqxt6xy8.fsf@jenny-gnome.dyndns.org>, > Yohanes Santoso writes: > >> Otherwise, the original code: >> >> n = read(fileno(fptr->f), RSTRING(str)->ptr, ilen); >> >> could also corrupt memory because another thread may have resize str >> to less than ilen. > > There is check code. > > if (RSTRING(str)->len != ilen) { > rb_raise(rb_eRuntimeError, "buffer string modified"); > } > -- > Tanaka Akira That check code has been updated in the patch too: if (RSTRING(str)->len != initial_len + ilen) { rb_raise(rb_eRuntimeError, "buffer string modified"); } 1. Is that sufficient? I can't produce a test case where I could modify (including resizing) the string without some exception being thrown, thus corrupting memory as asked in your original question. 2. In any case, I am retracting this patch because I and one other person are not getting consistent performance improvement with this patch. My initial finding seems to point to the linear-growth of the string and also at the mercy of the numerous realloc() being performed. I'll play with exponential-growing string. YS.