I'd try to use the C++ api to simplify object management and reduce
occurrence of such issues.  You might need the attached patch to work with
it though (git based pag, applies against 1.8.12).


On Sun, Nov 24, 2013 at 9:59 PM, Nicholas Yue <[email protected]>wrote:

> Hi,
>
>     I have a class which opens HDF file in the constructor and close HDF
> file in the destructor.
>
>     All seems fine until I tried wrapping it up in a boost smart pointer
> in an OpenGL Glut application.
>
>     The H5fclose() fails (was fine without the smart pointer) so I am in
> the process of tracking down any HDF5 resource leak due to my bad
> programming.
>
>     Is there some mode we can build our application to use HDF5 libraries
> so that resources are track and some statistics can be printed/dump out for
> developers to isolate where resources were created but not freed ?
>
>     I can use valgrind but I thought it there is something more specific
> to HDF5, I can cut down on the noise and focus only on HDF5 resources to
> start with.
>
> Cheers
>
> --
> Nicholas Yue
> Graphics - RenderMan, Visualization, OpenGL, HDF5
> Custom Dev - C++ porting, OSX, Linux, Windows
> http://au.linkedin.com/in/nicholasyue
> https://vimeo.com/channels/naiadtools
>
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-
> forum_lists.hdfgroup.org
>
From 169c7aa6e848bfdff970566ff894e0799c0e0ac8 Mon Sep 17 00:00:00 2001
From: Jason Newton <[email protected]>
Date: Fri, 7 Jun 2013 00:15:32 -0700
Subject: [PATCH 6/9] bugfix in c++ api: prevent passing H5F_ACC_CREATE to
 H5Fcreate, which is treated as an error

---
 c++/src/H5File.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 0b319cb..da45eb6 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -130,7 +130,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
     {
 	hid_t create_plist_id = create_plist.getId();
 	hid_t access_plist_id = access_plist.getId();
-	id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
+	id = H5Fcreate( name, flags & ~H5F_ACC_CREAT, create_plist_id, access_plist_id );
 	if( id < 0 )  // throw an exception when open/create fail
 	{
 	    throw FileIException("H5File constructor", "H5Fcreate failed");
-- 
1.8.1.4

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to