summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-11-29 15:49:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-11-29 15:49:38 (GMT)
commit6efa8215552705c9076079f5368cd64582f93918 (patch)
tree76d53a889fcba680c29eb903334a2c374f9d837d /tools
parent1bd42760c107d18e556485a56e5bf00b23a622d0 (diff)
downloadhdf5-6efa8215552705c9076079f5368cd64582f93918.zip
hdf5-6efa8215552705c9076079f5368cd64582f93918.tar.gz
hdf5-6efa8215552705c9076079f5368cd64582f93918.tar.bz2
[svn-r3017] Purpose:
Code cleanup/bug fix Description: Variable length datatypes were leaking memory when being dumped. Solution: Reclaim the VL data after each element has been dumped out. Platforms tested: FreeBSD 4.2 (hawkwind) & Solaris 2.6 (baldric)
Diffstat (limited to 'tools')
-rw-r--r--tools/h5tools.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/h5tools.c b/tools/h5tools.c
index 41532b6..3244025 100644
--- a/tools/h5tools.c
+++ b/tools/h5tools.c
@@ -105,11 +105,6 @@ extern int get_tableflag(table_t*, int);
extern int set_tableflag(table_t*, int);
extern char *get_objectname(table_t*, int);
-/* local functions */
-static void h5dump_simple_data(FILE *stream, const h5dump_t *info,
- hid_t container, h5dump_context_t *ctx/*in,out*/, unsigned flags,
- hsize_t nelmts, hid_t type, void *_mem);
-
/*-------------------------------------------------------------------------
* Function: h5tools_init
*
@@ -1086,6 +1081,7 @@ h5dump_sprint(h5dump_str_t *str/*in,out*/, const h5dump_t *info,
H5Tclose(memb);
} else if (H5T_VLEN==H5Tget_class(type)) {
unsigned int i;
+ hid_t space;
/* Get the VL sequences's base datatype for each element */
memb=H5Tget_super(type);
@@ -1129,6 +1125,15 @@ h5dump_sprint(h5dump_str_t *str/*in,out*/, const h5dump_t *info,
h5dump_str_append(str, "%s", OPT(info->vlen_suf, ")"));
H5Tclose(memb);
+
+ /* Create a datatype for reclaiming the memory */
+ space=H5Screate(H5S_SCALAR);
+
+ /* Reclaim the VL memory */
+ H5Dvlen_reclaim(type,space,H5P_DEFAULT,cp_vp);
+
+ /* Let the dataspace go */
+ H5Sclose(space);
} else {
/* All other types get printed as hexadecimal */
unsigned int i;