diff --git a/NEWS.md b/NEWS.md index 9cc478b29cb48..bac729c4e7a5e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -126,6 +126,9 @@ Standard library changes * `mmap` is now exported ([#39816]). +#### DelimitedFiles + +* `readdlm` now defaults to `use_mmap=false` on all OSes for consistent reliability in abnormal filesystem situations ([#40415]). Deprecated or removed --------------------- diff --git a/stdlib/DelimitedFiles/src/DelimitedFiles.jl b/stdlib/DelimitedFiles/src/DelimitedFiles.jl index bf88c12ea9cf2..3091fed79fee8 100644 --- a/stdlib/DelimitedFiles/src/DelimitedFiles.jl +++ b/stdlib/DelimitedFiles/src/DelimitedFiles.jl @@ -190,8 +190,9 @@ Specifying `skipstart` will ignore the corresponding number of initial lines fro If `skipblanks` is `true`, blank lines in the input will be ignored. If `use_mmap` is `true`, the file specified by `source` is memory mapped for potential -speedups. Default is `true` except on Windows. On Windows, you may want to specify `true` if -the file is large, and is only read once and not written to. +speedups if the file is large. Default is `false'. On a Windows filesystem, `use_mmap` should not be set +to `true` unless the file is only read once and is also not written to. +Some edge cases exist where an OS is Unix-like but the filesystem is Windows-like. If `quotes` is `true`, columns enclosed within double-quote (\") characters are allowed to contain new lines and column delimiters. Double-quote characters within a quoted field must @@ -232,7 +233,7 @@ readdlm_auto(input::IO, dlm::AbstractChar, T::Type, eol::AbstractChar, auto::Boo function readdlm_auto(input::AbstractString, dlm::AbstractChar, T::Type, eol::AbstractChar, auto::Bool; opts...) isfile(input) || throw(ArgumentError("Cannot open \'$input\': not a file")) optsd = val_opts(opts) - use_mmap = get(optsd, :use_mmap, Sys.iswindows() ? false : true) + use_mmap = get(optsd, :use_mmap, false) fsz = filesize(input) if use_mmap && fsz > 0 && fsz < typemax(Int) a = open(input, "r") do f