Skip to content

Automatic h5_garbage_collect() garbage collection #1186

@denglerchr

Description

@denglerchr

Good afternoon,

There might be a memory leak in HDF5, related to using driver=Drivers.Core(; backing_store=false).
I created a reduced exampled that can be reproduced as follows:

  1. generate a docker file including HDF5
# build with -> docker build -t hdf5test:1.0 .
FROM julia:1.11.2

RUN julia -e "import Pkg; Pkg.add([\"HDF5\", \"H5Zblosc\"])"
ENTRYPOINT ["julia"]
  1. run the following code in the docker container (e.g., run sudo docker run -it --memory=500m hdf5test:1.0 and copy the code ), it will be killed for OOM reason sooner or later
using HDF5

function main()
    while true
        h5open("abc.h5", "w"; driver=Drivers.Core(; backing_store=false)) do fid
            fid["M"] = randn(1000, 1000)
            return Vector{UInt8}(fid)
        end
        # GC.gc() # enabling or diabling doesnt change much
    end
    return nothing
end

main()

The container memory will immediately jump close to the limit and stay there for a while, for higher memory cap, it will take longer for the container to be killed. Once the container is killed, to be sure it was due to memory, you can docker inspect <containerid>

Best regards,
Christian Dengler

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions