??????????????
???????????? ???????[ 2011/12/20 14:10:21 ] ????????
????????functionName?????????????line???????????? pAddress???????????? size?????pAddress????????С??next?????????????
????c??????????????
??????MEMORY_SET_PROCESS????????У????????????memset??????????????????????м??????檔????????????????????????м???????????????pAddress?????????malloc????????????????????????????????????????????lib????????????????
??d??????????????????????
?????????memmove????????и???????????????????memmove?????????
??????????? #define memmove(dst?? src?? size) MEMMOVE_PROCESS(dst?? src?? size)
void MEMMOVE_PROCESS(void* dst?? const void* src?? int size)
{
MEMORY_NODE* pMemNode = check_node_exist(dst);
if(NULL == pMemNode) return;
assert(dst >= (pMemNode->pAddress));
assert(((char*)dst + size) <= ((char*)pMemNode->pAddress + pMemNode->size));
memmove(dst?? src?? size);
return;
}
????e???????????????????????
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????к?ebp??esp????????????????????????????????????????????κ?????????????????
#ifdef MEMORY_LEAK_TEST
#define FUNCTION_LOCAL_SPACE_RECORD()
{
int* functionBpRecord = 0;
int* functionSpRecord = 0;
}
#else
#define FUNCTION_LOCAL_SPACE_RECORD()
#endif
#ifdef MEMORY_LEAK_TEST
#define FUNCTION_LEAVE_PROCESS()
{
__asm { mov functionBpRecord?? bp
mov functionSpRecord?? sp}
FREE_MEMORY_NODE(functionBpRecord?? functionSpRecord)
}
#else
#define FUNCTION_LEAVE_PROCESS()
#endif
?????????κ???????????????????λ?ú??????λ???????????????????????????ebp??esp??????????е???????棬???????????????á???????????棬?????????仯?????μ????仯????????б???????????????????
????????????????????
??????1????memset???????????????????malloc???????????棻
??????2????memmove?? strcpy?? strncpy??strcat??sprintf????????????????????????????????????????????з?Χ?????ж??
??????3??????????????βλ????????????????з???????н???????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11