Page tree

The license could not be verified: License Certificate has expired!

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Content Layer
id1195548671
Content Column
width50.00001%
id1195578110
classrm_pagetree_col mobile-hide
Content Block
id1195578111
 
Content Column
width50.00001%
id1195548673
classhdf-rm-main-column
Content Block
id1195548672

Include Content
render-without-blockstrue
page.rm-navbar
HTML Wrap
classhdf-print-only

Page Title

HTML Wrap
classhdf-rm-summary-block

Hdf rm anchor
AnchorNamesummary

Excerpt

Resizes and, if required, re-allocates memory that will later be freed internally by the HDF5 library

.

HTML Wrap
classhdf-rm-content-block

Hdf rm anchor
AnchorNameprocedure

Procedure:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf_procedure

H5_RESIZE_MEMORY(mem, size)

Hdf rm anchor
AnchorNamesignature

Signature:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf-togglebox hdf-c

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-c

HTML
<pre><code class="language-c">void * H5resize_memory
(
    void   *mem,
    size_t  size
)</code></pre>

Hdf rm anchor
AnchorNameparameters

Parameters:
HTML Wrap
classhdf-rm-section
void *memIN: Pointer to a buffer to be resized

.


May be NULL

.

size_t sizeIN: New size of the buffer, in bytes

Hdf rm anchor
AnchorNamedescription

Description:
HTML Wrap
classhdf-rm-section

H5_RESIZE_MEMORY takes a pointer to an existing buffer and resizes the buffer to match the value in size. If necessary, the buffer is reallocated. If size is 0, the buffer is released.

The input buffer must either be NULL or have been allocated by H5_ALLOCATE_MEMORY since the input buffer may be freed by the library.

For certain behaviors, the pointer mem may be passed in as NULL.

This function is intended to have the semantics of realloc():

H5resize_memory(buffer, size)   Resizes buffer.
Returns pointer to resized buffer.
H5resize_memory(NULL, size)Allocates memory using HDF5 Library allocator.
Returns pointer to new buffer
H5resize_memory(buffer, 0)Frees memory using HDF5 Library allocator.
Returns NULL.
H5resize_memory(NULL, 0)Returns NULL (undefined in C standard).


Unlike realloc(), which allows for a “special” pointer to be returned instead of NULL, this function always returns NULL on failure or when size is 0 (zero).

At this time, the only intended use for this function is to resize or reallocate memory that will be returned to the library (and eventually to the user) as a data buffer from a third-party HDF5 filter.

Note

To avoid heap corruption, allocated memory should be freed using the same library that initially allocated it. In most cases, the HDF5 API uses resources that are allocated and freed either entirely by the user or entirely by the library, so this is not a problem. In rare cases, however, HDF5 API calls will free memory that the user allocated. This function allows the user to safely allocate this memory.

It is particularly important to use this function to resize memory on Microsoft Windows systems. In Windows, the C standard library is implemented in dynamic link libraries (DLLs) known as the C run-time (CRT). Each version of Visual Studio comes with multiple versions of the CRT DLLs (debug, release, et cetera) and allocating and freeing memory across DLL boundaries can cause resource leaks and subtle bugs due to heap corruption.

Even when using this function, it is still best to ensure that all components of a C application are built with the same version of Visual Studio and the same configuration (Debug or Release), and thus linked against the same CRT.

Only use this function to resize memory inside third-party HDF5 filters. It will generally not be safe to use this function to resize memory for any other purpose.

Hdf rm anchor
AnchorNamereturns

Returns:
HTML Wrap
classhdf-rm-section

On success, returns pointer to resized or reallocated buffer or returns NULL if size is 0 (zero).

Returns NULL on failure.

Hdf rm anchor
AnchorNameexample

Example:
HTML Wrap
classhdf-rm-section

Coming soon!

Comment (Hide)
HTML Wrap
classhdf-togglebox hdf-c

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathexamples/h5_subset.c
showLineNumberstrue
lineStart32
progLangcpp
lineEnd42
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

See Also:
HTML Wrap
classhdf-rm-section
Info

Content by Label
showLabelsfalse
showSpacefalse
excerptTypesimple
cqllabel = "rm_h5" and title ~ "H5_ALLOCATE_MEMORY"

Content by Label
showLabelsfalse
showSpacefalse
excerptTypesimple
cqllabel = "rm_h5" and title ~ "H5_FREE_MEMORY"

Hdf rm anchor
AnchorNamehistory

History:
HTML Wrap
classhdf-rm-section
Release    Change
1.8.15C function introduced with this release.