中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

同一個(gè)網(wǎng)站可以同時(shí)做競(jìng)價(jià)和優(yōu)化百度熱門(mén)排行榜

同一個(gè)網(wǎng)站可以同時(shí)做競(jìng)價(jià)和優(yōu)化,百度熱門(mén)排行榜,東莞網(wǎng)站建設(shè)案例,白山市住房和建設(shè)局網(wǎng)站文章目錄 RT-Thread 堆內(nèi)存 檢查命令 free 實(shí)現(xiàn)及介紹rt_memory_info 函數(shù)驗(yàn)證 RT-Thread 堆內(nèi)存 檢查命令 free 實(shí)現(xiàn)及介紹 在RT-Thread系統(tǒng)中,通常可以通過(guò)rt_memory_info函數(shù)獲取當(dāng)前的堆內(nèi)存使用信息,然后你可以包裝這個(gè)函數(shù)來(lái)顯示剩余的堆空間。rt…

文章目錄

    • RT-Thread 堆內(nèi)存 檢查命令 free 實(shí)現(xiàn)及介紹
      • rt_memory_info 函數(shù)驗(yàn)證

RT-Thread 堆內(nèi)存 檢查命令 free 實(shí)現(xiàn)及介紹

在RT-Thread系統(tǒng)中,通??梢酝ㄟ^(guò)rt_memory_info函數(shù)獲取當(dāng)前的堆內(nèi)存使用信息,然后你可以包裝這個(gè)函數(shù)來(lái)顯示剩余的堆空間。rt_memory_info實(shí)現(xiàn)見(jiàn):
rt-thread/src/mem.c:

void rt_memory_info(rt_uint32_t *total,rt_uint32_t *used,rt_uint32_t *max_used)
{if (total != RT_NULL)*total = mem_size_aligned;if (used  != RT_NULL)*used = used_mem;if (max_used != RT_NULL)*max_used = max_mem;
}

rt-thread 中其實(shí)已經(jīng)實(shí)現(xiàn)了cmd_free 函數(shù),可以使用這個(gè)函數(shù)來(lái)查看當(dāng)前堆的使用情況:

#ifdef RT_USING_HEAP
int cmd_free(int argc, char **argv)
{rt_uint32_t total = 0, used = 0, max_used = 0;rt_memory_info(&total, &used, &max_used);rt_kprintf("total   : %d\n", total);rt_kprintf("used    : %d\n", used);rt_kprintf("maximum : %d\n", max_used);return 0;
}
MSH_CMD_EXPORT_ALIAS(cmd_free, free, Show the memory usage in the system.);
#endif /* RT_USING_HEAP */

所以在終端執(zhí)行free 命令即可查看堆的使用情況:

msh >help
RT-Thread shell commands:
list             - list all commands in system
list_timer       - list timer in system
list_mempool     - list memory pool in system
list_memheap     - list memory heap in system
list_msgqueue    - list message queue in system
list_mailbox     - list mail box in system
list_mutex       - list mutex in system
list_event       - list event in system
list_sem         - list semaphore in system
list_thread      - list thread
version          - show RT - Thread version information
clear            - clear the terminal screen
hello            - say hello world
free             - Show the memory usage in the system.
ps               - List threads in the system.
help             - RT - Thread shell help.

rt_memory_info 函數(shù)驗(yàn)證

如下實(shí)現(xiàn)了一個(gè)測(cè)試函數(shù),在函數(shù)開(kāi)始的時(shí)候查看當(dāng)前堆使用了多少,然后再進(jìn)行rt_malloc(1024) 之后再查看下堆使用了多少,通過(guò)前后對(duì)比可以看出rt_memory_info函數(shù)獲取的信息是否正確。

#include <rtthread.h>
#include <pthread.h>#define TEST_MALLOC_SIZE        1024static int mem_check_test(void)
{char *ptr = RT_NULL;rt_uint32_t total = 0, used_pre = 0, max_used = 0;rt_uint32_t used_next = 0;rt_memory_info(&total, &used_pre, &max_used);ptr = (char *)rt_malloc(TEST_MALLOC_SIZE);if (ptr == RT_NULL) {rt_kprintf("mem check test failed\n");return -RT_ENOMEM;}rt_memory_info(&total, &used_next, &max_used);if ((used_next - used_pre) != TEST_MALLOC_SIZE + 16) {rt_kprintf("mem check test failed\n""mem used_pre: %d, mem used_next:%d\n",used_pre, used_next);rt_free(ptr);return -RT_ERROR;}rt_kprintf("mem check test ok\n");rt_free(ptr);return RT_EOK;
}
INIT_APP_EXPORT(mem_check_test);

關(guān)于free命令的本地測(cè)試如下:
在這里插入圖片描述
通過(guò)執(zhí)行free命令之后可以看到一共有多少heap和已經(jīng)使用了多少。

通常需要在跑完測(cè)試用例后不能影響heap的大小,簡(jiǎn)單點(diǎn)說(shuō)就是你的測(cè)試case不能導(dǎo)致內(nèi)存泄露。

http://www.risenshineclean.com/news/59718.html

相關(guān)文章:

  • 網(wǎng)站做導(dǎo)航的地圖seo模板建站
  • 惠州網(wǎng)站建設(shè) 翻譯6旅游搜索量環(huán)比增188%
  • 做文學(xué)網(wǎng)站用什么域名口碑營(yíng)銷(xiāo)怎么做
  • 商丘做網(wǎng)站哪家好上海廣告推廣
  • 網(wǎng)站開(kāi)發(fā)功能模塊出錯(cuò)seo課培訓(xùn)
  • 哪個(gè)網(wǎng)站做醫(yī)學(xué)培訓(xùn)好seo工作內(nèi)容和薪資
  • 浙江嘉興seo網(wǎng)站優(yōu)化推廣網(wǎng)絡(luò)推廣宣傳
  • 網(wǎng)站建設(shè)價(jià)格自動(dòng)點(diǎn)擊器怎么用
  • 廣西備案工信部網(wǎng)站營(yíng)銷(xiāo)型網(wǎng)站內(nèi)容
  • 潮州市住房和城鄉(xiāng)建設(shè)局網(wǎng)站站長(zhǎng)工具大全
  • b2b網(wǎng)站制作任務(wù)推廣引流平臺(tái)
  • wordpress 布局修改西安seo托管
  • 尋找網(wǎng)站建設(shè)_網(wǎng)站外包如何優(yōu)化網(wǎng)頁(yè)
  • 青島網(wǎng)站建設(shè)找潤(rùn)商大連seo按天付費(fèi)
  • 房地產(chǎn)行業(yè)網(wǎng)站跟我學(xué)seo從入門(mén)到精通
  • 重慶做網(wǎng)站價(jià)格百度一下首頁(yè)網(wǎng)址
  • 歐美網(wǎng)站建設(shè)排名北京網(wǎng)站seo服務(wù)
  • 如何在圖片上添加文字做網(wǎng)站網(wǎng)站備案查詢(xún)官網(wǎng)
  • 資源網(wǎng)站如何做網(wǎng)上開(kāi)店如何推廣自己的網(wǎng)店
  • 公司域名注冊(cè)網(wǎng)站哪個(gè)好合肥網(wǎng)絡(luò)推廣培訓(xùn)學(xué)校
  • 養(yǎng)生館室內(nèi)設(shè)計(jì)手機(jī)網(wǎng)站seo免費(fèi)軟件
  • 網(wǎng)站設(shè)計(jì)畢業(yè)論文任務(wù)書(shū)撫順優(yōu)化seo
  • 群暉ds1817做網(wǎng)站國(guó)外網(wǎng)站制作
  • 銅川公司做網(wǎng)站企業(yè)查詢(xún)系統(tǒng)官網(wǎng)
  • 南通網(wǎng)站優(yōu)化營(yíng)銷(xiāo)渠道模式有哪些
  • 做淘寶聯(lián)盟網(wǎng)站要多少錢(qián)建設(shè)網(wǎng)頁(yè)
  • 公司營(yíng)銷(xiāo)網(wǎng)站制作下載百度官方網(wǎng)站
  • 淫穢色情網(wǎng)站境外的南寧網(wǎng)站建設(shè)
  • 母嬰網(wǎng)站建設(shè)初衷如何免費(fèi)注冊(cè)網(wǎng)站平臺(tái)
  • 2023貴陽(yáng)疫情最新消息今天seo營(yíng)銷(xiāo)名詞解釋