ILto

uctools  时间:2021-02-05  阅读:()
October25,2006AnewMonoGCPaoloMolarolupus@novell.
com2CurrentGC:whyBoehmPortedtothemajorarchitecturesandsystemsFeaturefullVeryeasytointegrateHandlesmanagedpointersinunmanagedlandSomesupportfortypedobjectsFinalizationsemanticsmostlymatchWeakreferencesHightlytunedThread-localalloc3CurrentGC:whynotWedon'tneedorusesomeofthefeaturesIncremental(handlingofsignals.
.
.
)Resourceusage(publicAPI)FinalizationsemanticsnotthesameasneededFinalizationofobjectsinvolvedincycles(whichorder)WeakreferencesupportTrackresurrectionHeapfragmentationZeroingoverhead(atomicalloc.
.
.
)Pausetimes4NewGC:needsExactfinalizationandweakreferencesemanticsSmallheapsizesandlow-pausetime(desktopapps)Objectpinning(automaticandAPI-controlled)Fastallocation(bump-pointerandinlinableinmanagedcode)LargeobjecthandlingPrecisetypetracking5NewGC:needs(continued)InteriorpointersonthestackAppdomainunloadissues(freealltheobjectsintheappdomain)Allocationofnon-movingobjects(internedstrings.
.
.
)Nicetotheuser(nobigmemorychunk)StillalloweasyembeddingofMonoKeepingtheonlyreferencetoamanagedobjectintheCstackisfineThreadsupport6ImplementationGenerationalOldgenerationandnursery(thenewgeneration)MovingFromthenurserytotheoldgenerationCompactingoftheoldgenerationStoptheworldcollectionLargeobjectspaceCollectedwithmark&sweepduringmajorcollectionsFixedheapForinternedstrings(andmaybelaterothertypes)Collectedwithmark&sweepduringmajorcollections7GetHashCode()Objectsnowcanmove,can'tusetheobjectaddressashashcodeDatastoredinthelockwordoftheheaderWhentheobjectislocked,thehashcodeismovedinsidethefatlockstructureLoad+check+shiftinthefastpathAdditionalcheck+loadotherwiseInterlockedopwhenfirstsettingthehashmono_object_hash()forruntimehashtables8PinnedobjectsHowtocreatethem:corlibAPI:GCHandleembeddingAPI:mono_gchandle_new(obj,TRUE)fixedC#statement(PINNEDflagforlocalILvars)duringP/InvokecallsAdditionalcasesobjectsandpointersfoundintheuntypedCstackoftheruntimeandembeddingapplicationsobjectstheruntimesdoesn'twanttomove(internedstrings,Threadobjects,currentlyTypehandles)Fewoftheminpractice9PinnedobjectissuesWillfragmenttheheapWillcausemorecollectionsWillslowdownallocationsandcollectionsMakesureyoupinobjectsonlywhenreallyneededandforaslittletimeaspossibleRuntimeenhancements:TypeinformationaboutregistersandmanagedstackframeswillallowtoconsiderthereferencedobjectsnotpinnedUnmanagedstackframeswillstillpinreferencedobjectsforhassle-freeruntimecodeandmonoembedding10Pinnedobjects:findingthemGivena(possiblyinterior)pointerObjectsareallocatedsequentiallyNeedtostartfromthebeginningofanheaparea,visitingeachobjectuntilthecorrectoneisfoundDuringallocation,every4KBsavetheobjectstart–Needtoscanatmost4KBofmemorytofindobject–4KBsizeissubjecttochange–ThepinningaddressesaresortedandthelastpinnedobjectiscachedsousuallythisscanningisveryfastWhenfoundsetthePINflagoraddtopinnedobjectsarray11ThenurseryMostobjectsbornhereTypically512KB-2MBforcommonappsServersmightwantseveralMbsBump-pointerallocationstyleFastandcanbeinlinedinmanagedcodeWhenfull,triggeraminorcollectionUnlessamajorcollectionisneeded(oldgenerationisfull,too)Dividedinsmallerchunksduetofragmentationorthread-localallocation12NurseryandpinningPinnedobjectsfragmentthenurseryChunksoffreenurseryspacebetweenpinnedobjectsusedforallocationsWhenthenurseryiscompletelypinned,allocateobjectsintheoldgenerationAlternativesinclude:enlargethenursery,allocateanewnurseryPinobjectsonlywhenaboslutelyneededforshortamoutsoftimeTrackreferencespreciselyonthestack13MinorcollectionStoptheworldIdentifypinningobjectsScantheroots(includingpinnedobjects)CopytooldgenerationasyougoPlacepointertonewcopyintheoldobject'splaceScanthecopiedobjects(theyareroots,too)Checkthefinalizationandweak-reflistsPreparefornewallocsRestarttheworldPokethefinalizerthread14StoppingtheworldNeededtonotallowthemutatorstoseenon-coherentdatainobjectsforwardingpointersflagsintheobjectheadertwocopiesofthesameobjectNosupportforsafepoints(yet)Implementedwithsignalswin32/OSXhaveproperOSsupportLessthan1msforheapsupto100MBon1.
6PMParallelizemajorcollectionlater15TherootsStaticmanagedvariablesRegisteredroots(runtimeandembeddingdatastrutcures)HandletablesRememberedsetsOld-generationobjectsreferencingnurseryobjectsPinnedobjectsRuntimestackNeedtypeinfoforregistersandmanagedstackframes16HowtocopyanobjectEnsurewehaveenoughroomintheoldgenerationWeneedtoensureeveryreferencepointstothenewobjectForeachpointerfieldobj.
field=copy_object(obj.
field);Placeaforwardingpointerintheheader–It'sthepointertothenewhomeoftheobjectIfanobjecthasaforwardingpointerit'salreadycopiedPinnedobjectsreturnthesamepointerincopy_object()17ThemarkingstackWeneedtorecursivelycopytheobjectsreferencedbycopiedobjectRecursionnotasafethingintheGCTheruntimestackcouldbeverysmallandtherecursionverydeepThecopiedobjectsareaisanexplicitstackOncetherootsarescanned,scanthecopiedarea,untilnomoreobjectsarecopiedGrayobjectsaremarkedbutthefieldshavenotbeentraced18FinalizationWhentherootsarescanned,thenon-copiedobjectsaregarbageunlesstheyarepinnedorneedfinalizationCopyfinalizableobjectstotheoldgenerationsotheysurviveRecursivelycopyfromtheirfields,tooLoopuntilnomorefinalizableobjectsarefounddeadPutfinalizableobjectsinaseparatelistWeak-refsdon'tneedcopyinghandledimmediately19PreparefornewallocsCreatelistoffreefragmentsinnurserymemsetthememoryto0bytestoomuchoverheaddoingitateachobjectalloctoomuchoverheaddoingitforthewholenursery–touchestoomuchmemoryandtrashesthedatacache–doitonlyafragmentatatimeweneedunusednurseryareastobezeroedbeforecollectionsforthepinned-objectsfindingalgorithmAssignfragmentstothreadstoeachasmuchastheyneed(andresourcesallow)20MajorcollectionCurrentlycopy-basedLaterusemark/copytoreducememoryrequirementsIdentifypinnedobjectsinthewholeheapRememberedsetsareclearedScantherootsasusualLargeandfixedobjectsarejustmarkedbysettingaflagintheobjectheaderSweepunmarkedobjectsFreeunusedsectionsFinalize/Prepare/Restart21ObjectsweepingWalkthelistoflargeobjectsandfreetheunmarkedonesUnsetthemarkflagfortheothersFixedobjectsareinpinnedchunksfreedbyputtinginafree-listunmarkedaswellBoththelargeobjectlistandthenumberoffixedobjectsshouldbesmall22MemorysectionsHeapdividedinsectionsMoreflexiblethanusingabigvirtualareaEasierfortheuserExpandsasneededFairtoothercodeinthesameprogramcompetingforvirtualaddressspaceOfcourseit'shardertoimplementsomeperformanceissueslikelythedefaulton64bitsystems(hugevirtualmemoryspace)23PinnedchunksDatastructureforGC-internaldataandforfixedobjectallocationOnlyforsmallobjectsEachpagehasobjectsofsamesizeAllocationusingfreelistsPageassignedtoasizeasneededLimitedfragmentationissues(fewsizes,mostlyruntimeandGC-controlled)Mini-BoehmGCincluded24LargeobjectsExpensivetomoveCurrentlyusedforobjectsize>=64KBCollectedonlyduringmajorcollectionsusingmarkandsweepAllocatedwithmmapalreadycleared,noneedtotouchpagesNeedfortuningknobshowmuchmemorydoweallowinlargeobjectsbeforeamajorcollection25ObjectlayoutKeepreferencesclosetoeachotherBettercachelocalityBetterencodingofreferencebitmapsDegeneratecases.
.
.
Doctor,ithurtsWeshouldsetreasonablelimitsforuntrustedcodeTheJVMdoeshaveamuchbettertimewiththis.
.
.
nostructsnofixedorsequentiallayout26GCdescriptorsSeveraltypesneeded:stringsvectorsbitmapsrun-lengthencodinglargebitmapsFasthandlingofptrfreeobjectsandarraysStoredinMonoVTable27WritebarriersKeeptrackofreferencestonurseryobjectsfromtheoldgeneration:theybecomerootsforaminorcollectionComplicatedbystructsareferencecanbestoredintheheaporonthestackcopyofstructsCustomonesoptimizedforeachcasearraycopystructhandling28API/ABIchangesAfewsimplechangesneededforruntimehackersandembeddersObjectscanmove,sotheGCneedstoknowaboutallreferencesortheymustbepinnedsomeway–NomorevalidtoknowanobjectiskeptaliveandstoreareferenceinmallocmemoryFieldandarrayelementsettingmustgothroughwritebarriers–OnlyreferencesorvaluetypeswithreferencesInteriorpointerissues–ApointertotheendofanobjectisnotavalidinteriorpointerNewAPI:–MONO_OBJECT_SETREF(object,fieldname,value)–mono_array_setref(array,index,value)29TODOlistUsemark-compactforoldgenerationcollectionReducesmemoryrequiredforoldgencollectionUsemark-tablebasedwritebarriersFasterandinlineableThread-localallocationRemoveslockoverheadInlineallocationinjittedmanagedcodeNomanagedunmanagedtransitionsPrecisestackwalkReduceriskoffalsepositiveGCreferencesFixtheruntime30PreliminaryresultsStilluntuned,soexpectimprovementswritebarriers,thread-localalloc,alloccodeinliningSome(rare:-)testcases:5-7xspeedupUsually(withthread-local-alloc):10-50%speedupUsuallysmallerheap(butminimumislarger)Degeneratecases:manypinnedobjectsmanyreferencestores(writebarriers)longlinkedlists31KernelhelpThreadstart/stopneedtobeabletogetcontextofstoppedthreadmprotect(addr,size,MAP_DISCARD);dropthepagesfrommemorywillbeclearedwhenreadagainPagetablesdirtybitaccessMorecoarsewritebarriersupportNoneedforwritebarriersFixed(andpossiblytoolarge)markwindow32CompactingGarbageCollector.
33CompactingCollector34Nursery.
35NurseryandPinnedObjects.

CloudCone:KVM月付1.99美元起,洛杉矶机房,支持PayPal/支付宝

CloudCone的[2021 Flash Sale]活动仍在继续,针对独立服务器、VPS或者Hosted email,其中VPS主机基于KVM架构,最低每月1.99美元,支持7天退款到账户,可使用PayPal或者支付宝付款,先充值后下单的方式。这是一家成立于2017年的国外VPS主机商,提供独立服务器租用和VPS主机,其中VPS基于KVM架构,多个不同系列,也经常提供一些促销套餐,数据中心在洛杉...

速云:广州移动/深圳移动/广东联通/香港HKT等VDS,9折优惠,最低月付9元;深圳独立服务器1050元/首月起

速云怎么样?速云,国人商家,提供广州移动、深圳移动、广州茂名联通、香港hkt等VDS和独立服务器。现在暑期限时特惠,力度大。广州移动/深圳移动/广东联通/香港HKT等9折优惠,最低月付9元;暑期特惠,带宽、流量翻倍,深港mplc免费试用!点击进入:速云官方网站地址速云优惠码:全场9折优惠码:summer速云优惠活动:活动期间,所有地区所有配置可享受9折优惠,深圳/广州地区流量计费VDS可选择流量翻...

pia云低至20/月,七折美国服务器

Pia云是一家2018的开办的国人商家,原名叫哔哔云,目前整合到了魔方云平台上,商家主要销售VPS服务,采用KVM虚拟架构 ,机房有美国洛杉矶、中国香港和深圳地区,洛杉矶为crea机房,三网回程CN2 GIA,带20G防御,常看我测评的朋友应该知道,一般带防御去程都是骨干线路,香港的线路也是CN2直连大陆,目前商家重新开业,价格非常美丽,性价比较非常高,有需要的朋友可以关注一下。活动方案...

uctools为你推荐
支持ipad搜狗360电脑自动安装360安全浏览器北京大学cuteftpAliasedinternal大飞资讯单仁资讯集团怎么样三友网三友联众集团怎么样?三五互联科技股份有限公司三五互联 网站做的怎么样 公司打算做网站,近来接到电话,不知道网站做的如何,水平怎么样,后期的服务呢温州都市报招聘劳务市场找工作可靠吗如何发帖子如何发表帖子联系我们代码如何查询统一社会信用代码
美国域名注册 godaddy域名优惠码 青果网 彩虹ip 亚洲小于500m 本网站服务器在美国 华为网络硬盘 admit的用法 美国在线代理服务器 天翼云盘 web服务器安全 linode支付宝 lick smtp服务器地址 英雄联盟台服官网 免费网络 cdn网站加速 1美元 netvigator 免备案jsp空间 更多