VW Object Memory Management

Preview:

DESCRIPTION

ESUG 2011, Edinburgh

Citation preview

VisualWorks Object Memory Management

Andrés Valloud

Structure

Eden

SASB

Eden

Old

SASB

Eden

SASB

Eden

Perm

Old

Evolution

Instance creation

Scavenge 1

Scavenge 2

Scavenge 3

Scavenge 4

Tenured

IGC / GC

Perm save

Global GC

RIP

But, speaking of GC...

SASB

Eden

Perm

Old

Perm

OldRT

SASB

EdenScavenge finds

live objects faster

OldRT

PermOldRT

SASB

EdenScavenge finds

live objects faster

IGC / GC find live objects

faster

Responsibilities

OldRT

PermOldRT

SASB

Eden

OldRT

PermOldRT

SASB

EdenVM scavenges

new space

OldRT

PermOldRT

SASB

EdenVM scavenges

new spaceVI must ensure

success

OldRT

PermOldRT

SASB

EdenVM scavenges

new spaceVI must ensure

success

VM signals low memory

semaphore

OldRT

PermOldRT

SASB

EdenVM scavenges

new spaceVI must ensure

success

VI manages old space (GC,

grow, shrink)

VM signals low memory

semaphore

OldRT

PermOldRT

SASB

EdenVM scavenges

new spaceVI must ensure

success

VI manages old space (GC,

grow, shrink)

VM signals low memory

semaphore

VM (few) fixed actions

VI memory policy classes

Memory policies

OldRT

PermOldRT

SASB

EdenWorst case scavenge

OldRT

PermOldRT

SASB

EdenEden and

SA or SB fullWorst case scavenge

OldRT

PermOldRT

SASB

EdenEden and

SA or SB full

RT grows

Worst case scavenge

OldRT

PermOldRT

SASB

EdenEden and

SA or SB full

RT grows

Old RT grows

Worst case scavenge

OldRT

PermOldRT

SASB

EdenEden and

SA or SB full

RT grows

Old RT grows

Stack

Stack zone full, flushed to

object memory

Worst case scavenge

due to GC

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

The picture

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

The pictureGrowth

Increments

Improvements since VisualWorks 7.7

ObjectMemory>>igcState...aborting ifTrue: [^#aborting]....

MemoryPolicy>>dealWithIGC...memoryStatus igcState = #aborted

ifTrue: [“recover from IGC abort”]....

Fixed since VW 7.7

Fixed since VW 7.7

IGC does not recover from

stack overflow

ObjectMemory>>igcState...aborting ifTrue: [^#aborting]....

MemoryPolicy>>dealWithIGC...memoryStatus igcState = #aborted

ifTrue: [“recover from IGC abort”]....

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

Fixed since VW 7.7

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

Fixed since VW 7.7IGC as last

resort, bogus emergencies

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

Fixed since VW 7.7VM crash dueto scavenge

failure

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

Fixed since VW 7.7Too low for

modernapplications

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

Fixed since VW 7.7

GrowthIncrements

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

Fixed since VW 7.7Tiny growthincrement,

excessive GC

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

Fixed since VW 7.7Tiny growthincrement,

fragmentation

0Upper

Memory Bound

ImageSize

GrowthRegimeBound

EmergencyThreshold

Worst CaseScavenge

Fixed since VW 7.7Low free

memory limit, even more GC

New technology

New technologyTESTS

New technologyTESTS

•MemoryPolicyChecker

New technologyTESTS

•MemoryPolicyChecker

•MemoryPolicyTuner

New technologyTESTS

•MemoryPolicyChecker

•MemoryPolicyTuner

•MemoryPolicyStressTest

Before and after

Before

After

0Upper

Memory Bound

0Upper

Memory Bound

0

10,000

20,000

30,000

40,000

A (x100) B (x100) C (x400) D (x40) E (x40) F (x6) G (x6)

Run time per stress test case, in seconds

VW 7.7 legacy MemoryPolicy (with fixes) ~1 day, if they workVW 7.7.1 without sizesAtStartup tuning ~160 minutesVW 7.7.1 default ~73 minutes

A: pointer garbageB: byte garbageC: point creation

Segmented containerD: byte allocationE: pointer allocation

Large containerF: byte allocationG: pointer allocation

Print 2 web, ESUG 2009

Print 2 web, ESUG 2009

2.5x faster(with small

changes only)

X

VisualWorks 7.8and beyond

VisualWorks 7.8+

•Fixed space allocation fixed

•Improved weak / ephemeron support

•IGC performance improvements

•GC / IGC mark stack overflow prevention

•GC moves large objects back into large space

•New -m[1..7] VM switches

VisualWorks 7.8+

•Fixed space allocation fixed

•Improved weak / ephemeron support

•IGC performance improvements

•GC / IGC mark stack overflow prevention

•GC moves large objects back into large space

•New -m[1..7] VM switches

DONE

VisualWorks 7.9

VisualWorks 7.9

•Up to 40% faster GC

VisualWorks 7.9

•Up to 40% faster GC

•Improved IGC uses less memory

VisualWorks 7.9

•Up to 40% faster GC

•Improved IGC uses less memory

•Adaptive time based memory policy IGC driver

VisualWorks 7.9

•Up to 40% faster GC

•Improved IGC uses less memory

•Adaptive time based memory policy IGC driver

•Memory policy IGC smart abort

VisualWorks 7.9

•Up to 40% faster GC

•Improved IGC uses less memory

•Adaptive time based memory policy IGC driver

•Memory policy IGC smart abort

•Memory policy IGC switch

VisualWorks 7.9

•Up to 40% faster GC

•Improved IGC uses less memory

•Adaptive time based memory policy IGC driver

•Memory policy IGC smart abort

•Memory policy IGC switch

•Updates to the OldRT, become:, fixed space...

•Up to 40% faster GC

•Improved IGC uses less memory

•Adaptive time based memory policy IGC driver

•Memory policy IGC smart abort

•Memory policy IGC switch

•Updates to the OldRT, become:, fixed space...

VisualWorks 7.9

DONE

Questions?

Recommended