ucos-ii学习笔记——动态内存分配原理及使用
LCD_Write_COM(0x00,0x20);LCD_Write_DATA(x1>> LCD_Write_COM(0x00,0x53);LCD_Write_DATA(y2>> } void { #if #endif } void { #if #endif pdata=pdata; for( { PC_DispStr(10,++y,s1,DISP_BGND_BLACK+DISP_FGND_WHITE); IntBlkPtr=OSMemGet( &MemInfo); sprintf(s,"%0x",MemInfo.OSFreeList); PC_DispStr(30,y,s,DISP_BGND_BLACK+DISP_FGND_WHITE); sprintf(s,"%d",MemInfo.OSNUsed); PC_DispStr(40,y,s,DISP_BGND_BLACK+DISP_FGND_WHITE); if(Times>=5) { OSMemPut( IntBuffer, IntBlkPtr //此次释放,只能释放最后一次申请到的内存块,前面因为IntBlkPtr被后面的给覆盖掉了,所以释放 //不了。 ); } Times++; OSTimeDlyHMSM(0,0,1,0); } } void { #if #endif pdata=pdata; for( { PC_DispStr(10,++y,s2,DISP_BGND_BLACK+DISP_FGND_WHITE); IntBlkPtr=OSMemGet( &MemInfo); sprintf(s,"%0x",MemInfo.OSFreeList); PC_DispStr(30,y,s,DISP_BGND_BLACK+DISP_FGND_WHITE); sprintf(s,"%d",MemInfo.OSNUsed); PC_DispStr(40,y,s,DISP_BGND_BLACK+DISP_FGND_WHITE); OSMemPut( IntBuffer, IntBlkPtr ); OSTimeDlyHMSM(0,0,2,0); } } void { #if #endif pdata=pdata; for( { PC_DispStr(10,++y,s3,DISP_BGND_BLACK+DISP_FGND_WHITE); IntBlkPtr=OSMemGet( &MemInfo); sprintf(s,"%0x",MemInfo.OSFreeList); PC_DispStr(30,y,s,DISP_BGND_BLACK+DISP_FGND_WHITE); sprintf(s,"%d",MemInfo.OSNUsed); PC_DispStr(40,y,s,DISP_BGND_BLACK+DISP_FGND_WHITE); OSMemPut( IntBuffer, IntBlkPtr ); OSTimeDlyHMSM(0,0,1,0); } } //根据上面的分析可以很容易分析运行的现象了,从现象中可以看出,任务YouTask和HerTask申请了内存块使用完了 //后就释放了,而任务MyTask要一直到运行了6次后才释放所申请的内存块
ucos-ii动态内存分配原 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)