H5Pget_fclose_degree

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

H5Pget_fclose_degree

Ken Sullivan
I'm getting a curious crash and wonder if I'm doing something wrong:

Code snippet:

        herr_t ret;
        hid_t fapl_id = H5Pcreate( H5P_FILE_ACCESS );
        H5Pset_fclose_degree( fapl_id, H5F_CLOSE_STRONG ); //H5F_CLOSE_DEFAULT
        hid_t hdfFile = H5Fcreate(dbPathString, H5F_ACC_TRUNC, H5P_DEFAULT,  
fapl_id);
       
        hid_t fapl_id2 = H5Fget_access_plist(hdfFile);
        H5F_close_degree_t *fc_degree;
        //H5Pget_fclose_degree( fapl_id2, fc_degree ); //if uncommented,  
will crash soon after (bad access)

If the last line is uncommented, the program crashes in odd ways. The  
line executes in debugger, and I can verify that fc_degree points to  
a value consistent with the setting.  It's not until a few lines more  
are executed that it dies.   I'd like to verify that the above code  
should work before rooting around for deeper causes.  I'm using HDF5  
1.6.5 (fink port on mac).

Thanks,
Ken


----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

H5Pget_fclose_degree

Quincey Koziol
Hi Ken,

On Dec 11, 2007, at 12:55 PM, Kenneth Sullivan wrote:

> I'm getting a curious crash and wonder if I'm doing something wrong:
>
> Code snippet:
>
> herr_t ret;
> hid_t fapl_id = H5Pcreate( H5P_FILE_ACCESS );
> H5Pset_fclose_degree( fapl_id, H5F_CLOSE_STRONG ); //
> H5F_CLOSE_DEFAULT
> hid_t hdfFile = H5Fcreate(dbPathString, H5F_ACC_TRUNC,  
> H5P_DEFAULT, fapl_id);
>
> hid_t fapl_id2 = H5Fget_access_plist(hdfFile);
> H5F_close_degree_t *fc_degree;
> //H5Pget_fclose_degree( fapl_id2, fc_degree ); //if uncommented,  
> will crash soon after (bad access)
>
> If the last line is uncommented, the program crashes in odd ways.  
> The line executes in debugger, and I can verify that fc_degree  
> points to a value consistent with the setting.  It's not until a  
> few lines more are executed that it dies.   I'd like to verify that  
> the above code should work before rooting around for deeper  
> causes.  I'm using HDF5 1.6.5 (fink port on mac).

        You want to change the last two lines to this:

        H5F_close_degree_t fc_degree;
        H5Pget_fclose_degree( fapl_id2, &fc_degree ); //if uncommented, will  
crash soon

        Putting values in uninitialized pointers is bad, in general. :-) :-)

                Quincey


> Thanks,
> Ken
>
>
> ----------------------------------------------------------------------
> This mailing list is for HDF software users discussion.
> To subscribe to this list, send a message to hdf-forum-
> subscribe at hdfgroup.org.
> To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.
>
>


----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

H5Pget_fclose_degree

Ken Sullivan
Ach, I guess my brain is already done for the year. I had a feeling I  
was doing something bone-headed...but wow. Thanks!

On Dec 11, 2007, at 10:59 AM, Quincey Koziol wrote:

> Hi Ken,
>
> On Dec 11, 2007, at 12:55 PM, Kenneth Sullivan wrote:
>
>> I'm getting a curious crash and wonder if I'm doing something wrong:
>>
>> Code snippet:
>>
>> herr_t ret;
>> hid_t fapl_id = H5Pcreate( H5P_FILE_ACCESS );
>> H5Pset_fclose_degree( fapl_id, H5F_CLOSE_STRONG ); //
>> H5F_CLOSE_DEFAULT
>> hid_t hdfFile = H5Fcreate(dbPathString, H5F_ACC_TRUNC,  
>> H5P_DEFAULT, fapl_id);
>>
>> hid_t fapl_id2 = H5Fget_access_plist(hdfFile);
>> H5F_close_degree_t *fc_degree;
>> //H5Pget_fclose_degree( fapl_id2, fc_degree ); //if uncommented,  
>> will crash soon after (bad access)
>>
>> If the last line is uncommented, the program crashes in odd ways.  
>> The line executes in debugger, and I can verify that fc_degree  
>> points to a value consistent with the setting.  It's not until a  
>> few lines more are executed that it dies.   I'd like to verify  
>> that the above code should work before rooting around for deeper  
>> causes.  I'm using HDF5 1.6.5 (fink port on mac).
>
> You want to change the last two lines to this:
>
> H5F_close_degree_t fc_degree;
> H5Pget_fclose_degree( fapl_id2, &fc_degree ); //if uncommented,  
> will crash soon
>
> Putting values in uninitialized pointers is bad, in general. :-) :-)
>
> Quincey
>
>
>> Thanks,
>> Ken
>>
>>
>> ---------------------------------------------------------------------
>> -
>> This mailing list is for HDF software users discussion.
>> To subscribe to this list, send a message to hdf-forum-
>> subscribe at hdfgroup.org.
>> To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.
>>
>>
>
>
> ----------------------------------------------------------------------
> This mailing list is for HDF software users discussion.
> To subscribe to this list, send a message to hdf-forum-
> subscribe at hdfgroup.org.
> To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.
>




Loading...