Skip to content

Commit

Permalink
Do not try to memory-map zero-size data.
Browse files Browse the repository at this point in the history
  • Loading branch information
orenbenkiki committed Jun 4, 2024
1 parent 3ec9716 commit 0bbb6c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/v0.1.0/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.0","generation_timestamp":"2024-06-04T08:50:31","documenter_version":"1.4.1"}}
{"documenter":{"julia_version":"1.10.0","generation_timestamp":"2024-06-04T11:06:02","documenter_version":"1.4.1"}}
4 changes: 2 additions & 2 deletions src/h5df_format.jl
Original file line number Diff line number Diff line change
Expand Up @@ -879,15 +879,15 @@ function Formats.format_get_matrix(
end

function dataset_as_vector(dataset::HDF5.Dataset)::Tuple{StorageVector, CacheType}
if HDF5.ismmappable(dataset) && HDF5.iscontiguous(dataset)
if HDF5.ismmappable(dataset) && HDF5.iscontiguous(dataset) && length(dataset) > 0
return (HDF5.readmmap(dataset), MappedData)
else
return (read(dataset), MemoryData)
end
end

function dataset_as_matrix(dataset::HDF5.Dataset)::Tuple{StorageMatrix, CacheType}
if HDF5.ismmappable(dataset) && HDF5.iscontiguous(dataset)
if HDF5.ismmappable(dataset) && HDF5.iscontiguous(dataset) && length(dataset) > 0
return (HDF5.readmmap(dataset), MappedData)
else
return (read(dataset), MemoryData) # untested
Expand Down

0 comments on commit 0bbb6c1

Please sign in to comment.