InvalidMemoryOperationError from File.byLine()?

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 2 12:35:02 PDT 2015


On Tuesday, 2 June 2015 at 19:18:15 UTC, Stiff wrote:
> Hi,
>
> I'm reading in a rather large text file (~25Mb) line by line, 
> where I don't need to hang on to a line for more than one 
> iteration through my loop. I'm consistently getting an 
> InvalidMemoryOperationError on my 2,547th iteration, and based 
> on console outputs, I'm fairly certain it's coming from the 
> byLine() method. To be clear, I'm just doing a simple:
>
> foreach (line; file.byLine()){ ... }
>
> Am I possibly screwing something up? I haven't declared any 
> classes or written any destructors. Is this a bug? If so, is 
> there a workaround?
>
> Thanks!

Can you provide a minimal test case? I.e. as short of a program 
and input file as you can get that still has the error?


More information about the Digitalmars-d-learn mailing list