Release stream resources
When your DataBlade API module no longer needs a stream, you need to assess whether you can release resources that the stream is using.
- The mi_stream_close() function closes the stream, freeing the stream descriptor.
- The current memory duration expires.
To conserve resources, use the mi_stream_close() function to deallocate the stream descriptor explicitly when your DataBlade API module no longer needs it. The mi_stream_close() function is the destructor function for a stream descriptor. This function frees a stream descriptor that mi_stream_init() allocated and any associated resources, including the stream-data buffer.
The mi_stream_close() function does not automatically free a stream descriptor allocated by your stream-open function. If the mi_stream_init() function does not allocate a stream descriptor, your type-specific implementation of mi_stream_close() must handle the deallocation.