InvalidMemoryOperationError from File.byLine()?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 2 14:35:53 PDT 2015


On 6/2/15 5:22 PM, Stiff wrote:
> On Tuesday, 2 June 2015 at 21:15:19 UTC, Stiff wrote:
>> On Tuesday, 2 June 2015 at 21:10:20 UTC, Stiff wrote:
>>> I'm on dmd v2.067 (according to dmd --version), using Arch Linux
>>> kernel version 4.0.4-2. I installed dmd from the Arch community repo
>>> just a couple days ago.
>>
>> Sorry, x86_64.
>
> ....and for what it's worth, it looks like my second line has 2046
> characters, including the newline, which is sorta consistent with Iain's
> test case.

OK. I can reproduce now with all 3 test cases. I tweaked the line sizes 
a little bit. Noting that it fails on 2.067.0 and 2.067.1 on Linux x64, 
but passes just fine on OSX same versions.

FWIW, you don't need anything except foreach(line; somefile.byLine()) {} 
as your main code.

I think the correct fix is to fix readln as outlined in Ranier's pull 
request: https://github.com/D-Programming-Language/phobos/pull/2794

But that seems to be stalled. I will at least try to fix the 
assumeSafeAppend calls so they are not crashing.

-Steve


More information about the Digitalmars-d-learn mailing list