| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Referring to `BaseObject` instances using standard C++ smart pointers can interfere with BaseObject’s own cleanup mechanisms (explicit delete, delete-on-GC and delete-on-cleanup). Introducing custom smart pointers allows referring to `BaseObject`s safely while keeping those mechanisms intact. Refs: nodejs/quic#141 Refs: nodejs/quic#149 Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: nodejs/quic#141 Reviewed-By: James M Snell <jasnell@gmail.com>
This is no longer necessary now that the copyable `BaseObjectPtr` is available (as opposed to the only-movable `v8::Global`).
This allows keeping `BaseObjectPtr`s to `HandleWrap` instances. Previously, the pointer kept the `HandleWrap` object alive, leaving the Environment cleanup code that waits for the handle list to drain in a busy loop, because only the `HandleWrap` destructor removed the item from the list. Refs: nodejs/quic#165 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Referring to `BaseObject` instances using standard C++ smart pointers can interfere with BaseObject’s own cleanup mechanisms (explicit delete, delete-on-GC and delete-on-cleanup). Introducing custom smart pointers allows referring to `BaseObject`s safely while keeping those mechanisms intact. Refs: nodejs/quic#141 Refs: nodejs/quic#149 Reviewed-By: James M Snell <jasnell@gmail.com> PR-URL: #30374 Refs: nodejs/quic#165 Reviewed-By: David Carlier <devnexen@gmail.com>
Refs: nodejs/quic#141 Reviewed-By: James M Snell <jasnell@gmail.com> PR-URL: #30374 Refs: nodejs/quic#149 Refs: nodejs/quic#165 Reviewed-By: David Carlier <devnexen@gmail.com>
PR-URL: #30374 Refs: nodejs/quic#141 Refs: nodejs/quic#149 Refs: nodejs/quic#141 Refs: nodejs/quic#165 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This is no longer necessary now that the copyable `BaseObjectPtr` is available (as opposed to the only-movable `v8::Global`). PR-URL: #30374 Refs: nodejs/quic#141 Refs: nodejs/quic#149 Refs: nodejs/quic#141 Refs: nodejs/quic#165 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This allows keeping `BaseObjectPtr`s to `HandleWrap` instances. Previously, the pointer kept the `HandleWrap` object alive, leaving the Environment cleanup code that waits for the handle list to drain in a busy loop, because only the `HandleWrap` destructor removed the item from the list. Refs: nodejs/quic#165 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> PR-URL: #30374 Refs: nodejs/quic#141 Refs: nodejs/quic#149 Refs: nodejs/quic#141 Reviewed-By: David Carlier <devnexen@gmail.com>
|
@addaleax should this be backported or is this blocked on another PR that should be backported first? It does not land cleanly on our v13.x-staging currently. Please either update the labels accordingly or open a manual backport, thanks! |
Sorry, something went wrong.
|
I think this should have an easier time landing after the V8 7.9 backport. |
Sorry, something went wrong.
Referring to `BaseObject` instances using standard C++ smart pointers can interfere with BaseObject’s own cleanup mechanisms (explicit delete, delete-on-GC and delete-on-cleanup). Introducing custom smart pointers allows referring to `BaseObject`s safely while keeping those mechanisms intact. Refs: nodejs/quic#141 Refs: nodejs/quic#149 Reviewed-By: James M Snell <jasnell@gmail.com> PR-URL: #30374 Refs: nodejs/quic#165 Reviewed-By: David Carlier <devnexen@gmail.com>
|
@addaleax ASAN is showing a memory leak apparently originated here (BaseObjectPtrImpl::PointerData is leaking). Several tests are showing this warning. The simples one (less operations) is cctest BaseObjectPtrTest::ScopedDetachedWithWeak. Seems like the weak_ptr_count is not decreased after BaseObjectPtr is deleted (after the inner scope ends). I don't think this is the expected behavior, but I'm not sure. If it is the expected behavior, we might want to ignore LSAN for pointer_data. |
Sorry, something went wrong.
|
For most of these, when the object is freed is dependent entirely on the garbage collector. Could it be the case that the reported leaks are simply objects that the garbage collector hasn't gotten to yet? |
Sorry, something went wrong.
Fix the condition for deleting the underlying data pointed to by a `BaseObjectWeakPtr`, which erroneously skipped that deletion when `ptr->get()` was `nullptr`. This fixes a memory leak reported by some of the tests. Refs: nodejs#30374 (comment)
|
@mmarchini Thanks, see #32393 for a fix. 👍 @jasnell For context, the test referred to above is dealing with “detached” BaseObjects in the sense of Lines 95 to 99 in c160073 GC should not come into play as the objects are explicitly owned by the shared pointers in that case. |
Sorry, something went wrong.
This test doesn't rely on GC. #32393 fixed the issue :) |
Sorry, something went wrong.
|
Ah right right.. carry on and don't mind me :-D |
Sorry, something went wrong.
Fix the condition for deleting the underlying data pointed to by a `BaseObjectWeakPtr`, which erroneously skipped that deletion when `ptr->get()` was `nullptr`. This fixes a memory leak reported by some of the tests. Refs: nodejs#30374 (comment)
Fix the condition for deleting the underlying data pointed to by a `BaseObjectWeakPtr`, which erroneously skipped that deletion when `ptr->get()` was `nullptr`. This fixes a memory leak reported by some of the tests. Refs: #30374 (comment) PR-URL: #32393 Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fix the condition for deleting the underlying data pointed to by a `BaseObjectWeakPtr`, which erroneously skipped that deletion when `ptr->get()` was `nullptr`. This fixes a memory leak reported by some of the tests. Refs: #30374 (comment) PR-URL: #32393 Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fix the condition for deleting the underlying data pointed to by a `BaseObjectWeakPtr`, which erroneously skipped that deletion when `ptr->get()` was `nullptr`. This fixes a memory leak reported by some of the tests. Refs: #30374 (comment) PR-URL: #32393 Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
| Back | FazBrowse Home | New Git URL |
Note: Some of the commits here are from https://github.com/nodejs/quic/, where this concept has proven useful so far.
src: introduce custom smart pointers for BaseObjects
Referring to BaseObject instances using standard C++ smart pointers
can interfere with BaseObject’s own cleanup mechanisms
(explicit delete, delete-on-GC and delete-on-cleanup).
Introducing custom smart pointers allows referring to BaseObjects
safely while keeping those mechanisms intact.
Refs: nodejs/quic#141
Refs: nodejs/quic#149
Reviewed-By: James M Snell jasnell@gmail.com
http2: use custom BaseObject smart pointers
Refs: nodejs/quic#141
Reviewed-By: James M Snell jasnell@gmail.com
src: use BaseObjectPtr for keeping channel alive in dns bindings
src: remove keep alive option from SetImmediate()
This is no longer necessary now that the copyable BaseObjectPtr
is available (as opposed to the only-movable v8::Global).
src: remove HandleWrap instances from list once closed
This allows keeping BaseObjectPtrs to HandleWrap instances.
Previously, the pointer kept the HandleWrap object alive, leaving
the Environment cleanup code that waits for the handle list to drain
in a busy loop, because only the HandleWrap destructor removed
the item from the list.
Refs: nodejs/quic#165
Reviewed-By: James M Snell jasnell@gmail.com
Reviewed-By: Daniel Bevenius daniel.bevenius@gmail.com
Checklist