From 5b64cc60b9b2d743a28c5732b647743b42ef88a0 Mon Sep 17 00:00:00 2001 From: Ivan Krylov Date: Thu, 22 Nov 2018 18:49:33 +0300 Subject: 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 --- docs/src/handle.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/src') 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. -- cgit v1.2.3