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.

阿里云秋季促销活动 轻量云服务器2G5M配置新购年60元

已经有一段时间没有分享阿里云服务商的促销活动,主要原因在于他们以前的促销都仅限新用户,而且我们大部分人都已经有过账户基本上促销活动和我们无缘。即便老用户可选新产品购买,也是比较配置较高的,所以就懒得分享。这不看到有阿里云金秋活动,有不错的促销活动可以允许产品新购。即便我们是老用户,但是比如你没有购买过他们轻量服务器,也是可以享受优惠活动的。这次轻量服务器在金秋活动中力度折扣比较大,2G5M配置年付...

百纵科技(19元/月),美国洛杉矶10G防御服务器/洛杉矶C3机房 带金盾高防

百纵科技官网:https://www.baizon.cn/百纵科技:美国云服务器活动重磅来袭,洛杉矶C3机房 带金盾高防,会员后台可自助管理防火墙,添加黑白名单 CC策略开启低中高.CPU全系列E52680v3 DDR4内存 三星固态盘列阵。另有高防清洗!美国洛杉矶 CN2 云服务器CPU内存带宽数据盘防御价格1H1G10M10G10G19元/月 购买地址2H1G10M10G10G29元/月 购买...

华纳云CN2高防1810M带宽独享,三网直cn218元/月,2M带宽;独服/高防6折购

华纳云怎么样?华纳云是香港老牌的IDC服务商,成立于2015年,主要提供中国香港/美国节点的服务器及网络安全产品、比如,香港服务器、香港云服务器、香港高防服务器、香港高防IP、美国云服务器、机柜出租以及云虚拟主机等。以极速 BGP 冗余网络、CN2 GIA 回国专线以及多年技能经验,帮助全球数十万家企业实现业务转型攀升。华纳云针对618返场活动,华纳云推出一系列热销产品活动,香港云服务器低至3折,...

uctools为你推荐
深圳市腾讯计算机thinkphpthinkphp框架有什么功能及使用方法mediawikiMediaWiki的权限及设置360和搜狗360搜索和搜狗搜索谁好谁流量大?为什么我在网上搜索到的数据有一定矛盾?做广告推广哪个好呢?my.qq.commy.qq.com我是CF会员吗文档下载怎么下载百度文档三五互联科技股份有限公司三五互联 网站做的怎么样 公司打算做网站,近来接到电话,不知道网站做的如何,水平怎么样,后期的服务呢discuz伪静态discuz怎么才能把专题目录也实现伪静态的方法详解艾泰科技艾泰路由器设置!!!qq挂件如何使QQ气泡和挂件成为永久的?
什么是域名 万网域名管理 美国便宜货网站 域名优惠码 云图标 台湾谷歌网址 合租空间 广州服务器 web服务器安全 购买国外空间 深圳域名 摩尔庄园注册 apnic 阿里云个人邮箱 forwarder 美国西雅图独立 tko 大硬盘分区 主机响 sockscap怎么用 更多