Skip to content

Commit

Permalink
doc: clarify expected memory management strategy
Browse files Browse the repository at this point in the history
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. libuv#2078, https://stackoverflow.com/q/25615340).

PR-URL: libuv#2087
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
aitap authored and bnoordhuis committed Dec 2, 2018
1 parent c5593b5 commit 5b64cc6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/src/handle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5b64cc6

Please sign in to comment.