欢迎来到天天文库
浏览记录
ID:9221209
大小:1.25 MB
页数:57页
时间:2018-04-23
《tornado_vxworks官方培训教程3》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Chapter8Memory微迪软件培训中心嵌入式培训专题MemoryLayoutLOCAL_MEM_LOCAL_ADRSRAM_LOW-ADRSVxWorkFREE_RAM_ADRSsWDB_POOL_SIZESYSTEMMEMORYPOOLsysMemTop()USER_RESERVED_MEMsysPhysMemTop()微迪软件培训中心嵌入式培训专题TargetServerMemoryPoolApoolofmemoryonthetargetreservedforusebytheTornadoto
2、ols:Dynamicloadingofobjectmodules.SpawningtaskfromWindShorCrossWind.CreationofvariablesfromWindSh.Thetargetservermanagesthepool,keepingoverheadsuchasblocklistsonthehost.TheinitialsizeofthetargetservermemorypoolisconfiguredbyWDB_POOL_SIZE.Thedefaultis1/16
3、ofsysMemTop()-FREE_RAM_ADRS.Additionalmemoryissilentlyallocatedfromthesystemmemorypool,ifneeded.微迪软件培训中心嵌入式培训专题SystemMemoryPoolUsedfordynamicmemoryallocationinprograms:malloc().Creatingtasks(stackandTCB).VxWorksmemoryrequests.Initializedatsystemstartup.C
4、anmodifyUSER_RESERVED_MEMtoreservememoryforapplication-specificuse.MayneedtomodifysysPhysMemTop()(orjustLOCAL_MEM_SIZE)whenaddingmemorytoyourboard.Toaddoffboardmemory:voidmemAddToPool(pPool,poolSize)pPoolmustbethelocaladdressofthememory.微迪软件培训中心嵌入式培训专题Al
5、locating/ReleasingMemoryTodynamicallyallocatememory:void*malloc(nBytes)ReturnsapointertothenewlyallocatedmemoryorNULLonerror.Usesfirst-fitalgorithm.Freememoryisstoredinalinkedlist.Some(small)overheadforeachmalloc().Toreleaseallocatedmemory:voidfree(ptr)A
6、djacentblocksarecoalesced.微迪软件培训中心嵌入式培训专题DebuggingOptionsDefaultmalloc()debugging:Ifrequesttoolarge,loganerrormessage.Defaultfree()debugging:Checkblockforconsistency.Ifcorrupted:suspendtask,logerrormessage.Canchangedefaultdebuggingoptionswith:voidmemOpti
7、onsSet(options)Optionscanbe:+MEM_ALLOC_ERROR_LOG_FLAG-MEM_ALLOC_ERROR_SUSPEND_FLAG+MEM_BLOCK_CHECK+MEM_BLOCK_ERROR_LOG_FLAG+MEM_BLOCK_ERROR_SUSPEND_FLAG微迪软件培训中心嵌入式培训专题ExaminingMemoryUsethebrowser.EnterthememorypartitionIDintheShowbox.mv152-external@mekon
8、g:MempartOxTotalbytes=3870840Allocatedblocks=86bytes=467224Freeblocks=7FreeListbytes=3403584Cummulativeblocks=88bytes=467832FreeList0addr=0x3fd8f8size=96041addr=0x4ef90size=3355432微迪软件培训中心嵌入式培训专题AdditionalSystemMemoryManag
此文档下载收益归作者所有