diff options
author | Ivan Krylov <krylov.r00t@gmail.com> | 2018-11-22 18:49:33 +0300 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2018-12-02 15:50:39 +0100 |
commit | 5b64cc60b9b2d743a28c5732b647743b42ef88a0 (patch) | |
tree | e36372a80a1faaafa31ddb3607a5ea2352f604c0 /docs/src | |
parent | c5593b51dc98715f7f32a919301b5801ebf1a8ce (diff) | |
download | libuv-5b64cc60b9b2d743a28c5732b647743b42ef88a0.tar.gz libuv-5b64cc60b9b2d743a28c5732b647743b42ef88a0.zip |
doc: clarify expected memory management strategy
Right now, docs don't make it clear when exactly does it become okay to
free memory belonging to `uv_handle_t`. It's only stated that
`uv_close` must be called before freeing the memory, which is a source
of confusion for new users: they call `uv_close(handle, NULL)`, then
free the memory (see e.g. #2078, https://stackoverflow.com/q/25615340).
PR-URL: https://github.com/libuv/libuv/pull/2087
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/handle.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/src/handle.rst b/docs/src/handle.rst index 86fa811d..544794db 100644 --- a/docs/src/handle.rst +++ b/docs/src/handle.rst @@ -140,6 +140,8 @@ API Request handle to be closed. `close_cb` will be called asynchronously after this call. This MUST be called on each handle before memory is released. + Moreover, the memory can only be released in `close_cb` or after it has + returned. Handles that wrap file descriptors are closed immediately but `close_cb` will still be deferred to the next iteration of the event loop. |