Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2026-07-28 The HDF5 Field Guide

Loading...
Searching...
No Matches
H5Library Class Reference

`#include <c++/src/H5Library.h>`

## Detailed Description

Class H5Library operates the HDF5 library globably.

It is not necessary to construct an instance of H5Library to use the methods.

## Static Public Member Functions
static void | checkVersion (unsigned majnum, unsigned minnum, unsigned relnum)
| Verifies that the arguments match the version numbers compiled into the library.
static void | close ()
| Flushes all data to disk, closes files, and cleans up memory.
static void | dontAtExit ()
| Instructs library not to install the C `atexit` cleanup routine.
static void | garbageCollect ()
| Walks through all the garbage collection routines for the library, which are supposed to free any unused memory they have allocated.
static void | getLibVersion (unsigned &majnum, unsigned &minnum, unsigned &relnum)
| Returns the HDF library release number.
static void | initH5cpp (void)
| Initializes C++ library and registers terminating functions at exit. Only for the library functions, not for user-defined functions.
static void | open ()
| Initializes the HDF5 library.
static void | setFreeListLimits (int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim)
| Sets limits on the different kinds of free lists.
static void | termH5cpp (void)
| Sends request for the C layer to terminate.

## Member Function Documentation

## ◆ checkVersion()

void checkVersion | ( | unsigned | majnum,
|  | unsigned | minnum,
|  | unsigned | relnum )
| static

Verifies that the arguments match the version numbers compiled into the library.

Parameters

  majnum | - IN: Major version of the library
  minnum | - IN: Minor version of the library
  relnum | - IN: Release number of the library

Exceptions

  H5::LibraryIException |

Description
  For information about library version, please refer to the H5check_version API in the HDF5 C Reference Manual.

## ◆ close()

void close | ( |  | ) |
| static

Flushes all data to disk, closes files, and cleans up memory.

Exceptions

  H5::LibraryIException |

## ◆ dontAtExit()

void dontAtExit | ( |  | ) |
| static

Instructs library not to install the C `atexit` cleanup routine.

Exceptions

  H5::LibraryIException |

## ◆ garbageCollect()

void garbageCollect | ( |  | ) |
| static

Walks through all the garbage collection routines for the library, which are supposed to free any unused memory they have allocated.

Exceptions

  H5::LibraryIException |

Description
  It is not required that H5Library::garbageCollect be called at any particular time; it is only necessary in certain situations, such as when the application has performed actions that cause the library to allocate many objects. The application should call H5Library::garbageCollect if it eventually releases those objects and wants to reduce the memory used by the library from the peak usage required.

  The library automatically garbage collects all the free lists when the application ends.

## ◆ getLibVersion()

void getLibVersion | ( | unsigned & | majnum,
|  | unsigned & | minnum,
|  | unsigned & | relnum )
| static

Returns the HDF library release number.

Parameters

  majnum | - OUT: Major version of the library
  minnum | - OUT: Minor version of the library
  relnum | - OUT: Release number of the library

Exceptions

  H5::LibraryIException |

## ◆ initH5cpp()

void initH5cpp | ( | void |  | ) |
| static

Initializes C++ library and registers terminating functions at exit. Only for the library functions, not for user-defined functions.

Exceptions

  H5::LibraryIException |

## ◆ open()

void open | ( |  | ) |
| static

Initializes the HDF5 library.

Exceptions

  H5::LibraryIException |

## ◆ setFreeListLimits()

void setFreeListLimits | ( | int | reg_global_lim,
|  | int | reg_list_lim,
|  | int | arr_global_lim,
|  | int | arr_list_lim,
|  | int | blk_global_lim,
|  | int | blk_list_lim )
| static

Sets limits on the different kinds of free lists.

Parameters

  reg_global_lim | - IN: Limit on all "regular" free list memory used
  reg_list_lim | - IN: Limit on memory used in each "regular" free list
  arr_global_lim | - IN: Limit on all "array" free list memory used
  arr_list_lim | - IN: Limit on memory used in each "array" free list
  blk_global_lim | - IN: Limit on all "block" free list memory used
  blk_list_lim | - IN: Limit on memory used in each "block" free list

Exceptions

  H5::LibraryIException |

Description
  Setting a value of -1 for a limit means no limit of that type. For more information on free list limits, please refer to the H5set_free_list_limits API in the HDF5 C Reference Manual.

## ◆ termH5cpp()

void termH5cpp | ( | void |  | ) |
| static

Sends request for the C layer to terminate.

Description
  If the C library fails to terminate, exit with a failure.

The documentation for this class was generated from the following files:

- c++/src/H5Library.h
- c++/src/H5Library.cpp