Skip to content

Commit cd5eb55

Browse files
quildtideElOceanografo
authored andcommitted
Set DelimitedFiles.readdlm use_mmap default to false for all OSes (JuliaLang#40415)
Increased resilience to edge cases where OS is reported Unix-like but Filesystem is abnormal Fixes JuliaLang#8891 Fixes JuliaLang#40352
1 parent 6c06f05 commit cd5eb55

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ Standard library changes
132132

133133
* `mmap` is now exported ([#39816]).
134134

135+
#### DelimitedFiles
136+
137+
* `readdlm` now defaults to `use_mmap=false` on all OSes for consistent reliability in abnormal filesystem situations ([#40415]).
135138

136139
Deprecated or removed
137140
---------------------

stdlib/DelimitedFiles/src/DelimitedFiles.jl

+4-3
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ Specifying `skipstart` will ignore the corresponding number of initial lines fro
190190
If `skipblanks` is `true`, blank lines in the input will be ignored.
191191
192192
If `use_mmap` is `true`, the file specified by `source` is memory mapped for potential
193-
speedups. Default is `true` except on Windows. On Windows, you may want to specify `true` if
194-
the file is large, and is only read once and not written to.
193+
speedups if the file is large. Default is `false'. On a Windows filesystem, `use_mmap` should not be set
194+
to `true` unless the file is only read once and is also not written to.
195+
Some edge cases exist where an OS is Unix-like but the filesystem is Windows-like.
195196
196197
If `quotes` is `true`, columns enclosed within double-quote (\") characters are allowed to
197198
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
232233
function readdlm_auto(input::AbstractString, dlm::AbstractChar, T::Type, eol::AbstractChar, auto::Bool; opts...)
233234
isfile(input) || throw(ArgumentError("Cannot open \'$input\': not a file"))
234235
optsd = val_opts(opts)
235-
use_mmap = get(optsd, :use_mmap, Sys.iswindows() ? false : true)
236+
use_mmap = get(optsd, :use_mmap, false)
236237
fsz = filesize(input)
237238
if use_mmap && fsz > 0 && fsz < typemax(Int)
238239
a = open(input, "r") do f

0 commit comments

Comments
 (0)