Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(946)

Issue 10837122: Make AdjustAmountOfExternalAllocatedMemory() more robust. (Closed)

Created:
8 years, 4 months ago by ulan
Modified:
8 years, 4 months ago
CC:
v8-dev
Visibility:
Public.

Description

Make AdjustAmountOfExternalAllocatedMemory() more robust. Do not crash if called from a thread without V8 isolate, reset the external memory counters in case of overflow, bump the external allocation limit. This will allow us to track typed array allocation and deallocation in WebKit. BUG=v8:2022, 122097, 42342 R=jkummerow@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=12262

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -6 lines) Patch
M src/api.cc View 1 chunk +3 lines, -2 lines 2 comments Download
M src/heap.cc View 1 chunk +1 line, -1 line 1 comment Download
M src/heap-inl.h View 2 chunks +9 lines, -3 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
ulan
PTAL https://chromiumcodereview.appspot.com/10837122/diff/1/src/heap.cc File src/heap.cc (right): https://chromiumcodereview.appspot.com/10837122/diff/1/src/heap.cc#newcode5796 src/heap.cc:5796: external_allocation_limit_ = 16 * max_semispace_size_; The current limit ...
8 years, 4 months ago (2012-08-06 13:01:58 UTC) #1
Jakob Kummerow
lgtm
8 years, 4 months ago (2012-08-06 13:13:34 UTC) #2
Erik Corry
https://chromiumcodereview.appspot.com/10837122/diff/1/src/api.cc File src/api.cc (right): https://chromiumcodereview.appspot.com/10837122/diff/1/src/api.cc#newcode5279 src/api.cc:5279: if (isolate == NULL || !isolate->IsInitialized() || This seems ...
8 years, 4 months ago (2012-08-07 07:32:13 UTC) #3
ulan
8 years, 4 months ago (2012-08-07 09:05:52 UTC) #4
https://chromiumcodereview.appspot.com/10837122/diff/1/src/api.cc
File src/api.cc (right):

https://chromiumcodereview.appspot.com/10837122/diff/1/src/api.cc#newcode5279
src/api.cc:5279: if (isolate == NULL || !isolate->IsInitialized() ||
On 2012/08/07 07:32:13, Erik Corry wrote:
> This seems a bit fragile.  If we are silently ignoring some updates then the
> external memory count will become incorrect.  This will manifest itself as
very
> poor performance caused by too frequent GCs.  Perhaps it is better to let it
> crash and fix whatever it is that is calling from the wrong thread?

It's tricky with all those transfers between threads. We want this function to
be a no-op if called from the wrong thread, otherwise we would have to add guard
in each thread:
if (is_v8_initialized()) AdjustAmountOfExternalAllocatedMemory();

At the moment GC is triggered based on the delta of externally allocated  memory
since the last GC (the absolute value of externally allocated memory doesn't
matter). So even if we occasionally miss some updates, this error won't spread
beyond one GC. Of course if we change our heuristics to depend on absolute value
of external memory then we will have a problem.

Powered by Google App Engine
This is Rietveld 408576698