獲取線程堆棧剩餘大小

#import <pthread.h>

pthread_t currentThread = pthread_self();

uint8_t *endStack = pthread_get_stackaddr_np(currentThread); 

size_t totalStackSize = pthread_get_stacksize_np(currentThread);

uint8_t *frameAddr = __builtin_frame_address(0);

size_t remainingStackSize = totalStackSize - (size_t)(endStack - frameAddr);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章