Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Growing memory usage when opening and closing certain netcdf-files #2589

Closed
planetMDX opened this issue Jan 17, 2023 · 4 comments
Closed

Growing memory usage when opening and closing certain netcdf-files #2589

planetMDX opened this issue Jan 17, 2023 · 4 comments
Assignees

Comments

@planetMDX
Copy link

version netcdf: 4.9.0
OS: macos Ventura
compiler: Apple clang version 14.0.0 (clang-1400.0.29.202)
opening certain netcdf-files and closing them allocates memory without deallocating said memory when closing those files.

From https://www.unidata.ucar.edu/software/netcdf/examples/files.html only test_echam_spectral-deflated.nc, OMI-Aura_L2-example.nc and test_hgroups.nc show this behaviour.

Sample-code:

#include <netcdf.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
    setenv("HDF5_USE_FILE_LOCKING", "FALSE", 1);
    while (1)
    {
        int nid = 0;
        nc_open("/path/to/file/OMI-Aura_L2-example.nc", 0, &nid);
        nc_close(nid);
    }
    return 0;
}

after about 10 min I had about 65MiB heap usage according to the XCode-profiler.

@DennisHeimbigner
Copy link
Collaborator

What version of HDF5 are you using?

@DennisHeimbigner
Copy link
Collaborator

Also, do you have some equivalent of valgrind that you can run? Perhaps
clang on Max has the sanitizer flag?

@planetMDX
Copy link
Author

What version of HDF5 are you using?

1.12.2

I have done the same on my arch linux machine with netcdf 4.9.0-3 and hdf5 1.12.2-1 with a limited amount of loop repetitions: 10^6 results in a memory size of 385 MiB and 10^4 repetitions results in 57.1 MiB.
Valgrinding the 10^4 repetions with valgrind --leak-check=full --show-reachable=yes resulted in
repetions10000.
Running valgrind with the same options on the infinite loop and interrupting after ~1h results in this output: resultsInfinteInteruppted.

@planetMDX
Copy link
Author

this should be caused by #2723 and HDFGroup/hdf5#3396, of which the issue on the netcdf side is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants