Reallocate bytes from the host's heap.
This function changes the size of the memory block pointed to by ptr on the host's heap to size bytes. The memory block may be moved to a new location, which is returned by this function. The implementation performs an OCALL to the host, which calls realloc(). To free the memory, it must be passed to oe_host_free().
- Parameters
-
[in] | ptr | The memory block to change the size of. If NULL, this method allocates size bytes as if oe_host_malloc was invoked. If not NULL, it should be a pointer returned by a previous call to oe_host_calloc, oe_host_malloc or oe_host_realloc. |
[in] | size | The number of bytes to be allocated. If 0, this method deallocates the memory at ptr. If the new size is larger, the value of the memory in the new allocated range is indeterminate. |
- Returns
- The pointer to the reallocated memory or NULL if ptr was freed by setting size to 0. This method also returns NULL if it was unable to reallocate the memory, in which case the original ptr remains valid and its contents are unchanged.