summaryrefslogtreecommitdiffstats
path: root/src/H5FDsec2.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-08-16 20:13:02 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-08-16 20:13:02 (GMT)
commit1d54c2ad20754f7c4c05ef58dd4f15c773ddca89 (patch)
tree21dd94f4a6eabf3c29862a3fdb673e06acb6ce00 /src/H5FDsec2.c
parent4cd9c205ec2a7f2d216b2542c631840f5a24ebe0 (diff)
downloadhdf5-1d54c2ad20754f7c4c05ef58dd4f15c773ddca89.zip
hdf5-1d54c2ad20754f7c4c05ef58dd4f15c773ddca89.tar.gz
hdf5-1d54c2ad20754f7c4c05ef58dd4f15c773ddca89.tar.bz2
[svn-r2476] Added free lists to track various data structures in memory, to reduce malloc
abuse.
Diffstat (limited to 'src/H5FDsec2.c')
-rw-r--r--src/H5FDsec2.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 8211145..7d0a9cf 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -16,6 +16,7 @@
#include <H5Eprivate.h> /*error handling */
#include <H5Fprivate.h> /*files */
#include <H5FDsec2.h> /* Sec2 file driver */
+#include <H5FLprivate.h> /*Free Lists */
#include <H5MMprivate.h> /* Memory allocation */
#include <H5Pprivate.h> /*property lists */
@@ -162,6 +163,9 @@ static const H5FD_class_t H5FD_sec2_g = {
#define INTERFACE_INIT H5FD_sec2_init
static intn interface_initialize_g = 0;
+/* Declare a free list to manage the H5FD_sec2_t struct */
+H5FL_DEFINE_STATIC(H5FD_sec2_t);
+
/*-------------------------------------------------------------------------
* Function: H5FD_sec2_init
@@ -282,7 +286,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
}
/* Create the new file struct */
- if (NULL==(file=H5MM_calloc(sizeof(H5FD_sec2_t))))
+ if (NULL==(file=H5FL_ALLOC(H5FD_sec2_t,1)))
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"unable to allocate file struct");
file->fd = fd;
@@ -330,7 +334,7 @@ H5FD_sec2_close(H5FD_t *_file)
if (close(file->fd)<0)
HRETURN_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file");
- H5MM_xfree(file);
+ H5FL_FREE(H5FD_sec2_t,file);
FUNC_LEAVE(SUCCEED);
}