Blink Memory Reduction
(@BlinkOn5)
*
*
*
*
{haraken, bashi, tasak, hajimehoshi}@chromium.org
2015 Nov
Memory team projects
*
*
History
*
*
Strategy
*
*
Strategy
*
*
Strategy
*
*
Strategy
*
*
Agenda of this talk
*
*
Tooling
Allocator unification
*
*
Allocator unification
*
*
memory-infra
*
*
More detailed profiling
*
*
Object type | Size | Count |
Vector<RuleData> | 12256 bytes | 3 |
Vector<RuleFeature> | 800 bytes | 6 |
ImmutableStylePropertySet | 26 bytes | 2112 |
... | ... | ... |
More detailed profiling
StringImpl 1020 KB
<--- AtomicString::AtomicString()
<--- ScriptResource::script()
*
*
More detailed profiling
HTMLLinkElement::m_resource => locked discardable memory (620 KB)
FontCustomPlatformData::m_typeface => Skia (700 KB)
*
*
Q4/Q1 Roadmap
*
*
Understanding
Scope
*
*
Scope
*
*
Break down the memory into pieces
*
*
Break down of renderer’s memory
*
*
Page | Total (*1) | PartitionAlloc | Oilpan | V8 | Skia | Discardable | cc | malloc |
pinterest.com | 78.06 MB | 34.35% | 1.76% | 13.32% | 4.32% | 20.50% | 17.93% | 7.82% |
facebook.com | 70.13 MB | 33.02% | 1.25% | 8.63% | 16.64% | 17.11% | 14.97% | 8.38% |
worldjournal.com | 56.71 MB | 41.57% | 1.76% | 11.24% | 6.19% | 7.05% | 18.74% | 13.45% |
wikipedia.org | 44.32 MB | 34.82% | 2.26% | 11.92% | 2.28% | 9.03% | 23.69% | 16.01% |
reddit.com | 72.10 MB | 21.15% | 1.56% | 9.72% | 14.08% | 27.74% | 14.63% | 11.12% |
wordpress.com | 77.31 MB | 26.83% | 1.78% | 31.67% | 5.10% | 5.17% | 14.55% | 14.89% |
plus.google.com | 41.84 MB | 27.11% | 2.99% | 13.98% | 3.66% | 19.12% | 14.11% | 19.03% |
blogspot.com | 57.57 MB | 25.23% | 1.74% | 32.35% | 3.43% | 6.95% | 18.24% | 12.08% |
mail.google.com | 50.73 MB | 17.91% | 1.72% | 7.10% | 16.39% | 23.65% | 21.07% | 12.15% |
Break down of renderer’s memory
*
*
Break down of Blink’s memory
*
*
Break down of PartitionAlloc’s memory
*
*
Page | Total of PartitionAlloc | Buffer | FastMalloc | Node | Layout |
pinterest.com | 26.76 MB | 75.74% | 21.93% | 1.17% | 1.17% |
facebook.com | 23.30 MB | 35.90% | 58.46% | 1.44% | 4.19% |
worldjournal.com | 23.16 MB | 34.08% | 40.92% | 9.11% | 15.89% |
wikipedia.org | 15.56 MB | 37.25% | 37.15% | 9.74% | 15.86% |
reddit.com | 15.26 MB | 47.88% | 39.89% | 3.89% | 8.35% |
wordpress.com | 20.92 MB | 52.88% | 38.61% | 4.33% | 4.18% |
plus.google.com | 11.41 MB | 66.19% | 27.10% | 3.08% | 3.63% |
blogspot.com | 13.86 MB | 51.69% | 36.87% | 3.55% | 7.89% |
mail.google.com | 9.14 MB | 58.46% | 31.71% | 3.33% | 6.50% |
Break down of PartitionAlloc’s memory
*
*
Break down of the Buffer partition
*
*
Page | Total of the Buffer partition(*1) | StringImpls | Vectors | HashTables | Others |
pinterest.com | 9.51 MB | 90.19% | 2.64% | 6.98% | 0.19% |
facebook.com | 2.91 MB | 41.23% | 40.50% | 17.00% | 1.26% |
worldjournal.com | 3.22 MB | 45.61% | 39.00% | 14.68% | 0.71% |
wikipedia.org | 2.00 MB | 65.18% | 7.30% | 26.63% | 0.89% |
reddit.com | 2.89 MB | 41.21% | 42.39% | 16.21% | 0.20% |
wordpress.com | 4.94 MB | 55.32% | 29.88% | 14.50% | 0.29% |
plus.google.com | 2.62 MB | 81.56% | 7.23% | 10.77% | 0.44% |
blogspot.com | 2.89 MB | 66.53% | 14.02% | 17.88% | 1.57% |
mail.google.com | 2.11 MB | 30.77% | 54.24% | 13.99% | 1.00% |
Break down of the Buffer partition
*
*
Break down of the FastMalloc partition
*
*
Page | Total of the FastMalloc partition | SharedBuffers | Other objects |
pinterest.com | 2.38 MB | 15.93% | 84.07% |
facebook.com | 6.45 MB | 74.69% | 25.31% |
worldjournal.com | 2.90 MB | 53.12% | 46.88% |
wikipedia.org | 2.19 MB | 6.25% | 93.75% |
reddit.com | 2.32 MB | 13.47% | 86.53% |
wordpress.com | 3.58 MB | 27.36% | 72.64% |
plus.google.com | 0.92 MB | 13.22% | 86.78% |
blogspot.com | 2.32 MB | 22.88% | 77.12% |
mail.google.com | 1.01 MB | 0.00% | 100.00% |
Break down of the FastMalloc partition
*
*
Summary
*
*
What does it mean?
*
*
What does it mean?
*
*
What we have learned
*
*
What we have learned
*
*
What we have learned
*
*
Q4/Q1 roadmap
*
*
Reducing
Strategy
*
*
On-going reduction projects
*
*
MemoryPurgeController
class MemoryPurgeController {
void purgeMemory(...) { // Dispatched when Blink should save memory
for (auto& client : m_clients)
client->purgeMemory(...);
}
HashSet<MemoryPurgeClient*> m_clients;
};
class MemoryCache : public MemoryPurgeClient {
void purgeMemory(...) override { pruneAll(); } // Example
};
*
*
MemoryPurgeController
*
*
MemoryPurgeController
*
*
CompressableString
*
*
CompressableString
*
*
Page | Reduction rate |
pinterest.com | 63% |
facebook.com | 15% |
theverge.com | 11% |
worldjournal.com | 3% |
wikipedia.org | 19% |
reddit.com | 10% |
wordpress.com | 14% |
plus.google.com | 5% |
blogspot.com | 9% |
mail.google.com | 21% |
More aggressive Resource pruning
*
*
More aggressive Resource pruning
*
*
More aggressive Resource pruning
*
*
More aggressive Resource pruning
*
*
Making V8 ⇔ Blink cycles collectable
*
*
Making V8 ⇔ Blink cycles collectable
*
*
Making V8 ⇔ Blink cycles collectable
*
*
Making V8 ⇔ Blink cycles collectable
*
*
Summary
*
*
Q4/Q1 roadmap
*
*
Conclusions
Scope
*
*
Current understanding
*
*
Strategy
*
*
Strategy
*
*