Skip to content

Too many open files #11

@sambarluc

Description

@sambarluc

Hi,
I am getting an issue with memmaps and a long simulation (several .data files).

/home/cimatori/git/xmitgcm/xmitgcm/utils.py in read_raw_data(datafile, dtype, shape, use_mmap)
    109     if use_mmap:
    110         # print("Reading %s using memmap" % datafile)
--> 111         d = np.memmap(datafile, dtype, 'r')
    112         d.close()
    113     else:

/home/cimatori/installed/miniconda2/lib/python2.7/site-packages/numpy/core/memmap.pyc in __new__(subtype, filename, dtype, mode, offset, shape, order)
    258         bytes -= start
    259         offset -= start
--> 260         mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=start)
    261 
    262         self = ndarray.__new__(subtype, shape, dtype=descr, buffer=mm,

error: [Errno 24] Too many open files

The issue is known (see e.g. this question) but I don't seem to understand how to properly close the memmaped files, as I don't really understand yet how it interfaces with xarray.

On the practical side, I am able to work by setting use_mmap=False

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