asp.net pdf viewer : Change pdf page size application Library tool html .net wpf online hipeac05-paper0-part90

GarbageCollectionHints
DriesBuytaert,KrisVenstermans,LievenEeckhout,andKoenDeBosschere
ELISDepartment,GhentUniversity–HiPEACMember,
St.-Pietersnieuwstraat41,B-9000Gent,Belgium
{dbuytaer, kvenster, leeckhou, kdb}@elis.UGent.be
Abstract. This s papershows thatAppel-stylegarbagecollectors often
make suboptimal decisions s both h in n terms s of f when n and howto o collect.
We arguethat garbage collection should be donewhen theamount of
live bytes is s low w (in order r to minimize the e collection n cost) ) and d when
theamountof dead objectsishigh (inordertomaximizetheavailable
heapsizeaftercollection).Inaddition,weobservethatAppel-stylecol-
lectors sometimestriggeranurserycollectionincaseswhereafull-heap
collectionwouldhavebeenbetter.
Based on these observations, , we propose e garbage collection hints
(GCH) which is a profile-directed method d for r guiding garbage collec-
tion.Offlineprofilingisusedtoidentifyfavorablecollectionpointsinthe
programcode.Inthosefavorablecollection points,theVMdynamically
choosesbetweennurseryandfull-heapcollectionsbasedonananalytical
garbagecollectorcost-benefit model.Bydoingso,GCHguidesthecol-
lectorintermsofwhenandhowtocollect.Experimentalresultsusingthe
SPECjvm98 benchmarksand d twogenerationalgarbage collectors show
that substantial reductions can beobtained in garbage collection time
(upto30X)andthattheoverallexecutiontimecanbereducedbymore
than10%.
1 Introduction
Garbagecollection(GC)isanimportantsubjectofresearchasmanyoftodays
programminglanguagesystemsemployautomatedmemorymanagement.Pop-
ularexamplesareJava,C# and.NET.Beforediscussingthecontributionsof
thispaper,werevisitsomegarbagecollectionbackgroundandterminology.
1.1 GarbageCollection
AnAppel-stylegenerationalcopyingcollectordividestheheapintotwogenera-
tions[2],avariable-sizenurseryandamaturegeneration.Objectsareallocated
fromthenursery.Whenthenurseryfillsup,anurserycollectionistriggeredand
thesurvivingobjectsarecopiedintothematuregeneration.Whentheobjects
arecopied,thesizeofthematuregenerationisgrownandthesizeofthenurs-
eryisreducedaccordingly.Becausethenurserysizedecreases,thetimebetween
consecutivecollectionsalsodecreasesandobjectshavelesstimetodie.When
T. Conte etal.(Eds.):HiPEAC2005, LNCS3793, pp.233–248, 2005.
c Springer-VerlagBerlinHeidelberg2005
Change pdf page size - Compress reduce PDF size in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
C# Code & .NET API to Compress & Decompress PDF Document
best pdf compressor online; change font size on pdf text box
Change pdf page size - VB.NET PDF File Compress Library: Compress reduce PDF size in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Compression and Decompression Control SDK
change file size of pdf document; best way to compress pdf files
234
D.Buytaertetal.
thenurserysizedropsbelowagiventhreshold,afull-heapcollectionistriggered.
Afterafull-heapcollectionallfreespaceisreturnedtothenursery.
In this s paper we consider two o flavors s of generational l copying g collectors,
namelyGenMSandGenCopyfromJMTk[3].GenMScollectsthematuregener-
ationusingthemark-sweepgarbagecollectionstrategy.TheGenCopycollector
ontheotherhand,employsasemi-spacestrategytomanageitsmaturegenera-
tion.Thesemi-spacecollectorcopies scannedobjects,whereasthemark-sweep
collectordoesnot.
To partitionthe e heap intogenerations, , the e collector r has s to keep track k of
referencesbetweendifferent generations.Wheneveranobjectinthenurseryis
assignedtoanobjectinthematuregeneration—i.e.thereisareferencefroman
object inthematuregenerationtoanobjectinthenursery—thisinformation
is tracked by y using a so-called d remembered set. Whena nursery y collectionis
triggeredtherememberedsetmustbeprocessedtoavoiderroneouslycollecting
nurseryobjectsthatarereferencedonlyfromthematuregeneration.
1.2 PaperContributions
Whilegarbagecollectionoffersmanybenefits,thetimespentreclaimingmemory
canaccountforasignificantportionofthe totalexecutiontime [1].Although
garbagecollectionresearchhasbeenahotresearchtopicformanyyears,little
researchhasbeendonetodecidewhenandhowgarbagecollectorsshouldcollect.
Garbageistypicallycollectedwheneithertheheap,oragenerationisfull.
Ideally,the heapshouldbe collectedwhentheliveratiois low:thefewer live
objects,thefewerobjectsneedtobescannedand/orcopied,themorememory
there is s to o be reclaimed, and the e longer r we can n postpone the next garbage
collectionrun. In this s paper, , we showthat collecting priortoa fullheap,at
pointswheretheliveratioislow,canyieldsubstantialreductionsinGCtime.
In addition, when using g an Appel-style collector with two generations, a
decisionneedstobemadewhethertotriggerafull-heapor nurserycollection.
Wefoundthattriggeringnurserycollectionsuntilthenurserysizedropsbelowa
certainthresholdissometimessuboptimal.Inthispaper,weshowhowtotrade
off full-heapcollections andnurserycollections so that performance improves
substantially.
Theapproachpresentedinthispapertodecidewhenandhowtocollect,is
calledgarbagecollectionhints(GCH)andworksasfollows.GCHfirstdetermines
favorable collectionpoints(FCPs)foragivenapplicationthroughofflineprofil-
ing.Afavorablecollectionpointisalocationintheapplicationcodewherethe
costofacollectionisrelativelycheap.Duringprogramexecutionacostfunction
isthencomputedineachFCPtodeterminethebestGCstrategy:postponeGC,
performanurseryGC,orperformafull-heapGC.Ourexperimentalresultsus-
ingtheSPECjvm98benchmarksandtwogenerationalcollectorsshowthatGCH
canreducethegarbagecollectortimebyupto30Xandcanimprovetheoverall
executiontimebymorethan10%.
Figure1perfectlyillustrateswhygarbagecollectionhintsactuallyworkfor
the
213
javacbenchmark. This s graph h shows s the number r of f live bytes as a
C# PDF File Split Library: Split, seperate PDF into multiple files
Divide PDF file into multiple files by outputting PDF file size. control, C# developers can easily and accurately disassemble multi-page PDF document into two
change paper size in pdf document; change page size pdf acrobat
VB.NET PDF File Split Library: Split, seperate PDF into multiple
Separate source PDF document file by defined page range in VB.NET class application. Divide PDF file into multiple files by outputting PDF file size.
change font size pdf text box; apple compress pdf
GarbageCollectionHints
235
6
8
10
12
14
16
18
0
100
200
300
400
500
600
700
800
900
live data in MB
time in allocated MB
_213_javac, -s100, -m4 -M4 with 156 MB heap, GenCopy
full-heap collections without GCH 
nursery collections without GCH 
nursery collections with GCH 
Fig.1.Garbagecollection pointswithandwithoutGCH
function of f the number of allocatedbytes.The empty circles denote nursery
collectionsandthesquaresdenotefull-heapcollectionswhenGCHisnotenabled.
WithoutGCH,GCistriggeredatpointswherethenumberoflivebytesisnot
necessarilylow.Infact,themaximumGCtimethatweobservedonourplatform
fortheseGCpoints is 225ms;and12MBneedstobecopiedfromthenursery
tothematuregeneration.TheGCtimeforafull-heapcollectiontakes330ms.
WhenGCHisenabled(seethefilledcirclesinFigure1),garbagegetscollected
whentheamountoflivebytesreachesaminimum,i.e.atanFCP.TheGCtime
at an FCP P takes at most 4.5ms s since e only 126KBneeds to be copied.From
this example,weobservetwokey featureswhyGCH actuallyworks:(i) GCH
preferably collects whenthe amount oflive dataontheheapis low,and(ii)
GCHeliminatesanumberoffull-heapcollectionsbytradingthemfor(cheaper)
nurserycollections.
Themaincontributionsofthispaperareasfollows.
– WeshowthatGCisusuallynottriggeredwhentheamountoflivedatais
low,i.e.whentheamountofgarbagecollectionworkisminimal.
– Weshowthat t the collector does notalwaysmakethebest decisionwhen
choosingbetweenanurseryandafull-heapcollection.
– WeproposeGCH whichis s afeedback-directedtechnique basedonprofile
information that t provides hints s to o the collector r about when n and how to
collect.GCHtriestocollectatFCPswhentheamountoflivedataisminimal
anddynamicallychoosesbetweennurseryandfull-heapcollections.Theend
resultissignificantreductionsinGCtimeandimprovedoverallperformance.
GCHisespeciallybeneficialforapplicationsthat exhibitarecurringphase
behaviorintheamountoflivedataallocatedduringprogramexecution.
2 ExperimentalSetup
2.1 JavaVirtualMachine
WeusetheJikesResearchVirtualMachine2.3.2(RVM)[4]onanAMDAthlon
XP1500+ at1.3GHzwitha256KBL2-cache,runningLinux2.6.JikesRVM
is aJava virtualmachine e writtenalmost entirely in n Java. Jikes s RVM M uses s a
compilation-onlyschemefor translatingJavabytecodestonativemachinein-
structions.ForourexperimentsweusetheFastAdaptiveprofile:allmethodsare
C# PDF Thumbnail Create SDK: Draw thumbnail images for PDF in C#.
public override Bitmap ConvertToImage(Size targetSize). Description: Convert the PDF page to bitmap with specified size. Parameters:
advanced pdf compressor; change pdf page size
C# PDF Convert to Jpeg SDK: Convert PDF to JPEG images in C#.net
Using this C#.NET PDF to JPEG conversion library component toolkit, C# developers can easily and quickly convert a large-size multi-page PDF document to a
change page size of pdf document; best way to compress pdf
236
D.Buytaertetal.
initiallycompiledusingabaselinecompiler,butsamplingisusedtodetermine
whichmethodstorecompileusinganoptimizingcompiler.
BecauseJikesRVMiswrittenalmostentirelyinJava,internalobjectssuch
asthosecreatedduringclassloadingorthosecreatedbytheruntimecompilers
areallocatedfromtheJavaheap.Thus,unlikewithconventionalJavavirtual
machinestheheapcontainsbothapplicationdataaswellasVMdata.Wefound
thatthereisatleast8MBofVMdatathatisquasi-immortal.Thepresenceof
VMdatahastobetakenintoaccountwheninterpretingtheresultspresented
intheremainderofthiswork.
Jikes RVM’s s memory y management t toolkit t (JMTk) [3] ] offers several l GC
schemes.Whilethetechniquespresentedinthispaperaregenerallyapplicableto
variousgarbagecollectors,wefocusontheGenMSandGenCopycollectors.Both
beenusedinJikesRVM’sproductionbuildsthatareoptimizedforperformance.
TogetaroundabuginJikesRVM2.3.2weincreasedthemaximumsizeofthe
rememberedsetto256MB.Inordertobeabletomodeltheshrinking/growing
behavioroftheheapaccurately,wemadeonemodificationtotheoriginalRVM.
Weplacedtherememberedsetoutsidetheheap.
PerformanceismeasuredusingtheHardwarePerformanceMonitor(HPM)
subsystemofJikesRVM.HPMuses(i)theperfctr
1
Linuxkernelpatch,which
providesakernelmoduletoaccesstheprocessorhardware,and(ii)PAPI[5],ali-
brarytocapturetheprocessor’sperformancecounters.Thehardwareperformance
counterskeeptrackofthenumberofretiredinstructions,elapsedclockcycles,etc.
2.2 Benchmarks
To evaluate our r mechanism, , we use the e SPECjvm98
2
benchmark suite. The
SPECjvm98benchmarksuiteisaclient-sideJavabenchmarksuiteconsistingof
sevenbenchmarks,eachwiththreeinputsets:-s1,-s10and-s100.Withthe
-mand-Mparametersthebenchmarkcanbeconfiguredtorunmultipletimes
withoutstoppingtheVM.Garbagecollectionhintsworkwellfor longrunning
applications that showsome recurring phase behavior in the e amount t of f live
data.TomimicsuchworkloadswithSPECjvm98,weusethe-s100inputsetin
conjunctionwithrunningthebenchmarksfourtimes(-m4 -M4).
WeusedallSPECjvm98benchmarksexceptone,namely
222
mpegaudio,
because it merely allocates 15MBeachrunand d triggers s few w GCs. The other
benchmarksontheotherhand,allocatealotmore.
AllSPECjvm98bencharmksaresingle-threadedexceptfor
227
mtrtwhich
is amulti-threaded raytracer. Notethat t becausebothJikes RVM’s sampling
mechanismandtheoptimizingcompilerruninseparatethreadstheotherbench-
marksarenotdeterministic.
Weranallexperimentswitharangeofdifferentheapsizes.Wevarytheheap
sizebetweentheminimumfeasibleheapsizeandtheheapsizeatwhichourmech-
anismstopstriggeringorshowsconstantbehavior.Thelargertheheapsize,the
lessfrequentgarbageneedstobecollectedandthemoretimeobjectshavetodie.
1
http://user.it.uu.se/mikpe/linux/perfctr/
2
http://www.spec.org/jvm98/
C# PDF insert text Library: insert text into PDF content in C#.net
formatted text and plain text to PDF page using .NET NET PDF edit control allows modify existing scanned PDF text. Ability to change text font, color, size and
adjust file size of pdf; change font size in pdf text box
VB.NET PDF Thumbnail Create SDK: Draw thumbnail images for PDF in
Remove Password from PDF; Change PDF Permission Settings. String = Program.RootPath + "\\" 1.pdf" Dim doc New PDFDocument(inputFilePath) Dim page As PDFPage
pdf compression; change font size pdf form reader
GarbageCollectionHints
237
Some benchmarks like
213
javac use forced garbage e collections triggered
through calls s to o java.lang.System.gc(). . For our experiments we e disabled
forcedgarbagecollectionsunlessstatedotherwise.
3 Garbage e CollectionHints
Ourgarbagecollectionhintsapproachconsistsofanofflineandanonlinestep,
seeFigure2.Theofflinestepbreaksdownintotwoparts:offlineprofilingofthe
applicationandgarbagecollector analysis.The offline profiling g computes s the
live/timefunctionoftheapplication,i.e.theamountoflivebytesasafunction
ofthe amount of bytes s allocated.Basedonthis s live/time function, , favorable
collectionpoints(FCPs)canbedetermined.DeterminingtheFCPsisaone-time
costperapplication.Thegarbagecollectoranalysischaracterizesthecollection
cost for a a particular r GC C andapplication, i.e. the e amount of time e neededto
processa givenamount t of livebytes.This is dependent onthe collector and
theplatformonwhichthemeasurementsaredone.IntheonlinepartofGCH,
the methods that havebeenidentifiedas FCPs areinstrumentedtoinvokea
cost-benefitmodelthathelpsthegarbagecollectormakedecisionsaboutwhen
andhowtocollect.Thisdecisionmakingisbasedontheamountofheapspace
available,thelive/timefunctionoftheapplicationandthecharacteristicsofthe
GC.ThefollowingsubsectionsdiscussGCHinmoredetail.
Guide garbage
collection
offline
online
Analyse collector
Profile application
- Identify FCPs
- Capture live/time function
Fig.2.AnoverviewoftheGCHmethodology
3.1 ProgramAnalysis
Live/DeadRatioBehavior. Thefirststepoftheofflineprofilingistocollect
thelive/timefunctionwhichquantifiesthenumberoflivebytesasafunctionof
thebytesallocatedsofar.Moreover,weareinterestedinlinkingthelive/time
functiontomethodscalls.WemodifiedJikesRVMtotimestampandreportall
methodentries andexits.For eachmethodinvocation,wewant toknowhow
manyobjects/bytesdiedandhowmanyobjects arelive.Therefore,alifetime
analysis is requiredat every point anobject couldhavedied. . There aretwo
reasons for anobject to o die:(i) ) anobject’s last reference is overwrittenas a
resultofanassignmentoperation,or(ii)anobject’slastreferenceisonastack
frameandthestackframegetspoppedbecausetheframe’smethodreturnsor
becauseanexceptionis thrown.To o avoidhavingtodoalifetime analysis s for
C# PDF Convert to Tiff SDK: Convert PDF to tiff images in C#.net
zoomValue, The magnification of the original PDF page size. 0.1f
.pdf printing in thumbnail size; change font size in pdf form
C# PDF Convert to Word SDK: Convert PDF to Word library in C#.net
zoomValue, The magnification of the original PDF page size. 0.1f
change font size in pdf fillable form; pdf file size
238
D.Buytaertetal.
0
2
4
6
8
10
12
14
16
0
50
100
150
200
250
300
350
400
450
500
live data in MB
time in allocated MB
_201_compress -m4 -M4 -s100
0
2
4
6
8
10
12
0
200
400
600
800
1000
1200
live data in MB
time in allocated MB
_202_jess -m4 -M4 -s100
0
2
4
6
8
10
12
14
16
18
0
50
100
150
200
250
300
350
live data in MB
time in allocated MB
_209_db -m4 -M4 -s100
0
2
4
6
8
10
12
14
16
18
20
0
100
200
300
400
500
600
700
800
900
live data in MB
time in allocated MB
_213_javac -m4 -M4 -s100
0
5
10
15
20
25
0
100
200
300
400
500
600
700
live data in MB
time in allocated MB
_227_mtrt -m4 -M4 -s100
0
2
4
6
8
10
12
14
0
200
400
600
800
1000
1200
live data in MB
time in allocated MB
_228_jack -m4 -M4 -s100
Fig.3.Thelive/timefunction for thevariousbenchmarks:numberof live bytesas a
functionofthenumberofbytesallocated
everyassignmentoperation,methodreturnandexception,weusedamodified
versionoftheMerlintracegenerator [6]that is part of Jikes RVM.Merlinis
atoolthat preciselycomputes everyobject’slast reachabletime. It has been
modifiedtouseouralternativetimestampingmethodtocorrelateobjectdeath
withmethodinvocations.
Figure3showsthelive/timefunctionforthevariousbenchmarks.Ascanbe
seenfromthesegraphs,thelive/timefunctionshowsrecurringphasebehavior.
ThisrecurringphasebehaviorwillbeexploitedthroughGCH.Applicationsthat
donotexhibitaphasedlive/timefunctionarenotlikelytobenefitfromGCH.
Next,thelive/timefunctionis usedto o select t FCPs andtocomputethe FCP
live/timepatterns.
FavorableCollectionPoints. Foramethodtorepresentafavorablecollection
point(FCP),itneedstosatisfythreecriteria:
1. AnFCP’sinvocationshouldcorrespondtoalocalminimumintermsofthe
number oflive bytes. . Inotherwords,weneedtoselectmethods s that are
executedintheminimaofthelive/timefunction.This willallowGCHto
collectgarbagewithminimaleffort.
2. AnFCPshouldnotbeexecutedfrequently.Tominimizetheoverheadofthe
instrumentationcode,FCPs that representcoldmethods are preferred.A
methodthatgetsexecutedonlyinlocalminimaisanidealFCP.
3. Thelive/timepatternfollowingtheexecutionofthe FCPshouldbe fairly
predictable,i.e.eachtime the e FCP P gets executed, the live/time function
shouldhaveamoreorlesssimilarshapeforsomerangeaftertheFCP.
Giventhelive/timefunction,selectingFCPsisfairlystraightforward.Table1
showstheselectedFCPsthatweselectedfortheSPECjvm98benchmarks.Some
GarbageCollectionHints
239
Table1.TheselectedFCPsforeachofthebenchmarkapplications
Benchmark
Favorablecollectionpoints
201
compress
spec.io.FileInputStream.getContentLength()I
202
jess
spec.benchmarks.
202
jess.jess.
undefrule.<init>()V
spec.harness.BenchmarkTime.toString()Ljava/lang/String;
209
db
spec.harness.Context.setBenchmarkRelPath(Ljava/lang/String;)V
spec.io.FileInputStream.getCachingtime()J
213
javac
spec.benchmarks.
213
javac.ClassPath.<init>(Ljava/lang/String;)V
227
mtrt
spec.io.TableOfExistingFiles.<init>()V
spec.harness.Context.clearIOtime()V
spec.io.FileInputStream.getCachingtime()J
228
jack
spec.benchmarks.
228
jack.Jack
the
Parser
Generator
Internals.-
compare(Ljava/lang/String;Ljava/lang/String;)V
0
50
100
150
200
250
20
40
60
80
100
120
140
160
maximum collection time in ms
heap size in MB
_201_compress, GenMS
0
50
100
150
200
250
15
20
25
30
35
40
45
50
55
60
maximum collection time in ms
heap size in MB
_202_jess, GenMS
0
500
1000
1500
2000
2500
3000
3500
0
50
100
150
200
250
300
350
maximum collection time in ms
heap size in MB
_209_db, GenMS
0
50
100
150
200
250
300
350
400
40
60
80
100
120
140
160
180
200
maximum collection time in ms
heap size in MB
_213_javac, GenMS
0
50
100
150
200
250
300
350
20
40
60
80
100
120
140
160
180
200
maximum collection time in ms
heap size in MB
_227_mtrt, GenMS
full-heap collections at non-FCPs
full-heap collections at FCPs
nursery collections at non-FCPs
nursery collections at FCPs
0
50
100
150
200
250
300
10
20
30
40
50
60
70
80
90
100
maximum collection time in ms
heap size in MB
_228_jack, GenMS
full-heap collections at non-FCPs
full-heap collections at FCPs
nursery collections at non-FCPs
nursery collections at FCPs
Fig.4.Themaximumgarbagecollectiontimesacrossdifferentheap sizesfor each of
thedifferentscenarios
benchmarkshaveonlyoneFCP(seeforexampleFigure1for
213
javac);others
suchas
227
mtrthavethreeFCPs.
ToillustratethepotentialbenefitofFCPs,Figure4plotsthemaximumtime
spentinGCwhentriggeredatanFCPandwhentriggeredinanon-FCP.We
makeadistinctionbetweenfull-heapandnurserycollections,andplotdatafor
arangeofheapsizes.FormostbenchmarksweobservethatthemaximumGC
timespentatanFCPissubstantiallylowerthantheGCtimeinanon-FCP.This
240
D.Buytaertetal.
reinforcesourassumptionthatcollectingatanFCPischeaperthancollectingin
anon-FCP.However,therearetwoexceptions,
201
compressand
228
jack,
forwhichGCtimeisinsensitivetoFCPs.For
201
compress,thisisexplained
bythefactthatthelive/timefunctionshowninFigure3isduetoafewobjects
that areallocatedinthe LargeObject Space (LOS). Becauseobjects inLOS
nevergetcopied,GCHcannotreducethecopycost.Furthermore,becausethere
areonlyafewsuchobjectsitwillnotaffectthescancosteither.For
228
jack,
theheightofthelive/timefunction’s peaksisverylow,seeFigure3.Because
201
compressand
228
jackareinsensitivetoFCPsweexcludethemfromthe
otherresultsthatwillbepresentedinthispaper.(Infact,weappliedGCHto
thesebenchmarksbuttheresultwasaneutralimpactofoverallperformance.
Duetospaceconstraints,wedonottoincludethesebenchmarksintherestof
thispaper.)
Itisalsointerestingtonotethatfor
209
db,anurserycollectioncanbemore
costlythanafull-heapcollection.Thisisduetothefactthattheremembered
set needs to o be scannedon anursery collection.As such, for
209
db a full-
heapcollectioncanbemoreefficientthananurserycollection.Thisisexploited
throughGCH.
FCP’s Live/Time Pattern. . For r eachunique FCP wehaveto o capturethe
live/time pattern following g the FCP. This s is a a slice of the live/time function
followingtheFCPthatrecursthroughoutthecompleteprogramexecution.We
sample the FCP’s live/time patternat afrequency ofone sample per 0.5MB
ofallocatedmemoryanduseitasinputforthecost-benefit model.AnFCP’s
live/timepatternisindependentoftheheapsize(thesameinformationisused
forallheapsizes)andisindependentofthecollectionscheme(thesameinfor-
mationisusedfor bothGenMSandGenCopy).It onlyneedstobecomputed
onceforeachbenchmark.Forcompleteness,weaddthatinordertobeindepen-
dantofthecollectionscheme,wedifferentiatebetweendatathatiseligibletobe
copiedanddatathatcannotbecopied.
3.2 CollectorAnalysis
Sofar,wediscussedtheofflineprofilingthatisrequiredforGCH.Wenowdiscuss
thecharacterizationofthegarbagecollector.Thischaracterizationwillbeused
inthecostmodelthatwilldrivethedecisionmakinginGCHduringprogram
execution.The characterizationofthegarbagecollectorquantifies the costof
acollection.Weidentify threecost sources:the cost of afull-heapcollection,
thecostofanurserycollectionandthecostofprocessingtherememberedset.
Thecostfunctions takeas input the amount of livedataandoutput the esti-
matedcollectiontime.Thesecost functions aredependent ontheapplication,
thecollectorandthegivenplatform(VM,microprocessor,etc.).
Figure5showshowthecostfunctionsaretobedeterminedfortheGenMS
andGenCopy collectors.Thegraphsareobtainedbyrunningthebenchmarks
multipletimeswithdifferentheapsizesusinginstrumentedcollectors.Inthese
graphswemakeadistinctionbetweennurserycollections,full-heapcollections
GarbageCollectionHints
241
0
50
100
150
200
250
300
350
400
0
5
10
15
20
average processing time in ms
live data in nursery, expressed in MB
GenMS, nursery collections
_202_jess
_209_db
_213_javac
_227_mtrt
0
50
100
150
200
250
300
350
400
0
5
10
15
20
average processing time in ms
live data in nursery, expressed in MB
GenCopy, nursery collections
_202_jess
_209_db
_213_javac
_227_mtrt
0
50
100
150
200
250
300
350
400
0
2
4
6
8
10
12
14
16
18
20
average processing time in ms
live data in nursery and mature generation, expressed in MB
GenMS, full-heap collections
_202_jess
_209_db
_213_javac
_227_mtrt
0
50
100
150
200
250
300
350
400
0
2
4
6
8
10
12
14
16
18
20
average processing time in ms
live data in nursery and mature generation, expressed in MB
GenCopy, full-heap collections
_202_jess
_209_db
_213_javac
_227_mtrt
1
10
100
1000
10000
0.1
1
10
100
1000
average processing time in ms
size of remembered set, expressed in MB
GenMS, remembered sets
_202_jess
_209_db
_213_javac
_227_mtrt
1
10
100
1000
10000
0.1
1
10
100
1000
average processing time in ms
size of remembered set, expressed in MB
GenCopy, remembered sets
_202_jess
_209_db
_213_javac
_227_mtrt
Fig.5. The cost of a a nursery and d full-heap p collection in n terms s of f the amount of
copied/livedata
andprocessingoftherememberedset.Hence,theprocessingtimesonthenursery
collectiongraphsdonotincludethetimerequiredtoprocesstherememberedsets.
GCtimeappearstobealinearfunctionoftheamountoflivedataforboth
collectors.Inotherwords,thescanningandcopyingcostisproportionaltothe
amountoflivebytes.Likewise,theprocessingcostoftherememberedsetappears
tobealinearfunctionofitssize.Insummary,wecancomputelinearfunctions
thatquantifythecostofanurserycollection,full-heapcollectionandprocessing
oftherememberedset.
Inthispaperweemployapplication-specificcostfunctions,i.e.wecompute
costfunctions perapplication.Infact,onaspecializedsystemwithdedicated
longrunningapplications,itis appropriatetoconsideracostfunctionthatis
specificallytunedforthegivenapplication.Nevertheless,giventhefactthatthe
costfunctionsappeartobefairlysimilaracrossthevariousapplications,seeFig-
ure5,choosingapplication-independentcostfunctionscouldbeaviablescenario
forgeneral-purposeenvironments.Suchascenarioislikelytoproduceresultsthat
areonlyslightlyworsecomparedtotheonespresentedinthispaper.
3.3 GCHatWork
Theinformationthatiscollectedthroughourofflineanalysisisnowcommuni-
catedtotheVMtobeusedatruntime.JikesRVMreadsallprofileinformation
242
D.Buytaertetal.
atstartup.Thiscontains(i)alistofmethodsthatrepresenttheFCPs,(ii)the
live/time patternper r FCP,and(iii) ) the cost functions s for r the givengarbage
collector.JikesRVMisalsomodifiedtodynamicallyinstrumenttheFCPs.The
instrumentationcodeaddedto the FCPs s examines whether thecurrent FCP
shouldtriggeraGC.Thedecisiontocollectornotisadifficultoneasthereex-
istsatrade-offbetweenreducingtheamountofworkpercollectionandhaving
tocollectmorefrequently.Clearly,triggeringacollectionwillhaveaneffecton
subsequentcollections.BecauseGCisinvokedsoonerduetoGCHthanwithout
GCH,additionalcollectionsmightgetintroduced.Ontheotherhand,triggering
acollectionat anFCP canhelp p reducetheGCoverhead.A A collectionat an
FCPwillgenerallyintroducemodestpausetimescomparedtocollectionsata
non-FCPs.Moreover,triggeringafull-heapcollectiongrowsthenurserysizeand
givesobjects moretimetodie,whiletriggeringanurserycollectionwhenfew
objectsarelivewillresultinthematuregenerationfillingupslower,reducing
theneedformoreexpensivefull-heapcollections.
Tomakethis complextrade-off,theinstrumentationcodeintheFCPsim-
plementsananalyticalcost-benefitmodel.Thecost-benefitmodelestimatesthe
totalGCtimeforgettingfromthecurrentFCPtotheendofitsFCP’slive/time
pattern.Thecost-benefitmodelconsiders the followingthree scenarios:(i) do
nottriggeraGCinthecurrentFCP,(ii)triggerafull-heapGC,or(iii)triggera
nurseryGC.Foreachofthesethreescenarios,thecost-benefitmodelcomputes
thetotalGCtimebyanalyticallysimulatinghowtheheapwillevolvethrough
theFCP’slive/timepattern.Thisisdoneasfollows.First,thecost-benefitmodel
computestheGCcostinthecurrentFCPunderthethreescenarios:
(i) ThecostfornottriggeringaGCisobviouslyzero.Theavailableheapsize
remainsunchanged.
(ii) Forcomputingthecostfortriggeringafull-heapcollectioninthecurrent
FCP,wefirst calculatethenumberoflive bytesat thecurrent FCP.We
getthisinformationfromthelive/timepattern.We subsequentlyusethe
full-heapGCcostfunctiontocomputetheGCtimegiventheamountof
livedatainthecurrentFCP.Theavailableheapsizeafterthecurrent(hy-
pothetical)full-heapcollectionthenequalsthemaximumheapsizeminus
theamountoflivedatainthecurrentFCP.
(iii) TocomputethecostfortriggeringanurseryGCinthecurrentFCP,we
assumethattheamountoflivebytesinthenurseryatthatFCPiscloseto
zero.TheGCcostisthencomputedbasedonthenursery-GCcostfunction.
ThisGCcostisincrementedbyanextracostduetoprocessingtheremem-
beredset.Thisextracostisproportionaltothesizeoftherememberedset,
whichisknownatruntimeatanFCP.Theheapsizethatwasoccupiedby
thenurserybecomesavailableagainforallocation.
Inthesecondstepofthe cost-benefit modelwecomputethe costofaddi-
tional collections s over the FCP’s s live/time e pattern n for r each h of f the three sce-
narios.Infact,for eachscenario,thecost-benefit modelanalyticallysimulates
howtheheapwillevolveovertimewhengoingthroughanFCP’slive/timepat-
tern. Therefore, wecompute whenthe (nursery) heapwillbe full—whenthe
Documents you may be interested
Documents you may be interested