New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 716180 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug
Hotlist-MemoryInfra



Sign in to add a comment

HeapProfilerScopedIgnore should call end_ignore_scope() every time it begins one

Project Member Reported by erikc...@chromium.org, Apr 27 2017

Issue description

This scoped object currently calls the same conditional twice:
"""
  AllocationContextTracker::capture_mode() !=
            AllocationContextTracker::CaptureMode::DISABLED
"""

and relies on the assumption that this conditional will evaluate to the same thing in both cases. This is currently true because capture_mode is set at startup, but I expect this to be false in the not-too-distant future, and all the subtle:: code surrounding capture_mode_ sure makes it sound like it might change at any point in time.

Instead, the result of the conditional should be cached and we should use the cached value in place of evaluting teh conditional agian. This guarantees that there are an equal number of begin_ignore_scope and end_ignore_scope called.
 
so having a cached bool sgtm. Although that won't fix everything. 
Specifically, right now, if the heap profiler is turned on right in the middle of an ignored scope, the scope won't be ignored.
Which is probably fine if this is only for accounting (in which case we'll get an extra allocation we didn't want) but is not good if we try to use the macro for functional purposes (e.g., prevent to re-lock)

Comment 2 by ssid@chromium.org, Apr 28 2017

Summary: HeapProfilerScopedIgnore should call end_ignore_scope() every time it begins one (was: Guarantee that HeapProfilerScopedIgnore works correctly.)
+1 to caching the value if we are going to support disabling heap profiler.
end_ignore_scope() can handle the case of trying to call it when no scope was begun (it checks for 0 before decrementing).

Sign in to add a comment