[Issue 14630] Std.algorithm splitter segfault on large file with mmfile, seems GC related.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 9 23:22:55 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=14630
Boris Carvajal <boris2.9 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |boris2.9 at gmail.com
Resolution|--- |INVALID
--- Comment #1 from Boris Carvajal <boris2.9 at gmail.com> ---
The problem is that MmFile is a class and the construct "cast(string)mapFile[]"
doesn't prevent the object from being collected.
Declaring the variable with scope
scope mapFile = new MmFile(map_path);
or simply using it after the loop
foreach(line ; splitter(cast(string)mapFile[], '\n'))
{
...
}
mapFile.length;
makes the program succeed.
--
More information about the Digitalmars-d-bugs
mailing list