mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
deps: v8: fix potential segfault in profiler
This change fixes a potential segfault in the sampling heap profiler. This landed as part of a larger change upstream [1]. This is the minimal backport that avoids the segfault. [1]: https://git.io/vdTYL PR-URL: https://github.com/nodejs/node/pull/15498 Backport-PR-URL: https://github.com/nodejs/node/pull/16413 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
a7fc12772d
commit
ebee8edca2
1 file changed
+5
-2
+5
-2
@@ -172,8 +172,11 @@ class SamplingAllocationObserver : public AllocationObserver {
|
||||
void Step(int bytes_allocated, Address soon_object, size_t size) override {
|
||||
USE(heap_);
|
||||
DCHECK(heap_->gc_state() == Heap::NOT_IN_GC);
|
||||
DCHECK(soon_object);
|
||||
profiler_->SampleObject(soon_object, size);
|
||||
if (soon_object) {
|
||||
// TODO(ofrobots): it would be better to sample the next object rather
|
||||
// than skipping this sample epoch if soon_object happens to be null.
|
||||
profiler_->SampleObject(soon_object, size);
|
||||
}
|
||||
}
|
||||
|
||||
intptr_t GetNextStepSize() override { return GetNextSampleInterval(rate_); }
|
||||
|
||||
Reference in new issue
Block a user