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

Issue 2235653002: Add kGCCallbackFlagCollectAllExternalMemory (Closed)

Created:
4 years, 4 months ago by keishi
Modified:
4 years, 4 months ago
Reviewers:
haraken
CC:
v8-reviews_googlegroups.com, Hannes Payer (out of office), ulan
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Add kGCCallbackFlagCollectAllExternalMemory BUG=570268

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -5 lines) Patch
M include/v8.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/heap/heap.cc View 1 chunk +5 lines, -5 lines 0 comments Download

Messages

Total messages: 4 (2 generated)
keishi
This CL is a fix for c) Explanation: After investigating the memory leak for the ...
4 years, 4 months ago (2016-08-12 06:58:14 UTC) #3
haraken
4 years, 4 months ago (2016-08-12 07:11:00 UTC) #4
On 2016/08/12 06:58:14, keishi wrote:
> This CL is a fix for c)
> 
> Explanation:
> 
> After investigating the memory leak for the html below (crbug.com/570268) I
saw
> three problems.
> https://dl.dropboxusercontent.com/u/15217362/bloburl/bitmaptest.html
> 
> a) AdjustAmountOfExternalMemory is not called for ImageResource.
> b) external_memory_limit increases too much because it is adjusted after a v8
> gc, not blink gc.
> c) V8Followup blinkgc doesn't always run after a "external memory induced V8
GC"
> because ImageResource data is allocated in malloc and blinkgc doesn't know
about
> malloc.
> 
> I confirmed that we can reduce peak memory usage by 500MB (after 20 seconds of
> running the html) if these three problems are eliminated.
> 
> The fix for a) is https://codereview.chromium.org/2230133002/
> To keep the change simple and avoid issues like double counting memory this
only
> reports the ImageResource data size to v8.
> 
> The fix for c) is https://codereview.chromium.org/2235653002/ and
> https://codereview.chromium.org/2238173002/
> This adds a new callback flag so Blink can be extra careful to free the
external
> allocations.
> 
> external_memory_limit is set to (external_memory + 192MB) after a V8 GC. When
> external_memory becomes greater than external_memory_limit a V8 GC is
triggered.
> external_memory_limit increases too much because the external_memory hasn't
> shrunk yet.
> For example, for this html, i observed that the Image object requires two GC
> cycles for it to be collected.
> I'm not sure why but I believe the fact that the onload event handler
references
> the Image object makes the V8 Image object uncollectable until after a Blink
GC.
> The ImageResource data is not freed until a BlinkGC happens after that.
> The significant delay from when the V8 GC is triggered by external memory
alloc,
> and when the external memory is a problem but I don't think we can fix that.
> Instead I propose we reduce external_memory_limit when external_memory reduces
> https://codereview.chromium.org/2233683002/
> This will make it harder for the external_memory_limit to just keep on
> increasing, and I'm hoping it will have minimal negative impact.

(Let's address https://codereview.chromium.org/2238173002/ first before asking
V8 exports for review.)

Powered by Google App Engine
This is Rietveld 408576698