diff options
author | James Laird <jlaird@hdfgroup.org> | 2004-07-14 19:34:24 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2004-07-14 19:34:24 (GMT) |
commit | a0c466cd99e6d62725ac1828755b042c2dcb6c85 (patch) | |
tree | 8ef8956600e8765fe9a0fc96dcb5faa0798032e8 /src/H5HG.c | |
parent | 769ee96c1fd7cdcc4de2f2b1f36e943ebf9fff8b (diff) | |
download | hdf5-a0c466cd99e6d62725ac1828755b042c2dcb6c85.zip hdf5-a0c466cd99e6d62725ac1828755b042c2dcb6c85.tar.gz hdf5-a0c466cd99e6d62725ac1828755b042c2dcb6c85.tar.bz2 |
[svn-r8877]
Purpose:
Bug Fix
Description:
If an HDF5 file grows larger than its address space, it dies and is unable to
write any data. This is more likely to happen since users are able to change
the number of bytes used to store addresses in the file.
Solution:
HDF5 now throws an error instead of dying. In addition, it "reserves" address
space for the local heap and for object headers (which do not allocate space
immediately). This ensures that after the error occurs, there is enough address
space left to flush the entire file to disk, so no data is lost.
A more complete explanation is at /doc/html/TechNotes/ReservedFileSpace.html
Platforms tested:
sleipnir, copper (parallel), verbena, arabica, Windows (Visual Studio 7)
Solution:
Platforms tested:
Misc. update:
Diffstat (limited to 'src/H5HG.c')
-rw-r--r-- | src/H5HG.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -955,8 +955,14 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* * we can extend any of the collections to make enough room. */ if (!found) { + size_t new_need; + for (cwfsno=0; cwfsno<f->shared->ncwfs; cwfsno++) { - if((f->shared->cwfs[cwfsno]->size+need)<=H5HG_MAXSIZE && H5MF_can_extend(f,H5FD_MEM_GHEAP,f->shared->cwfs[cwfsno]->addr,(hsize_t)f->shared->cwfs[cwfsno]->size,(hsize_t)need)) { + new_need = need; + new_need -= f->shared->cwfs[cwfsno]->obj[0].size; + new_need = MAX(f->shared->cwfs[cwfsno]->size, new_need); + + if((f->shared->cwfs[cwfsno]->size+need)<=H5HG_MAXSIZE && H5MF_can_extend(f,H5FD_MEM_GHEAP,f->shared->cwfs[cwfsno]->addr,(hsize_t)f->shared->cwfs[cwfsno]->size,(hsize_t)new_need)) { if(H5HG_extend(f,f->shared->cwfs[cwfsno],size)<0) HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL, "unable to extend global heap collection"); addr = f->shared->cwfs[cwfsno]->addr; |