C++???????й??????
???????????? ???????[ 2014/10/30 11:20:41 ] ????????c++ ??? NET ???????
????2??????
#define MAX_FILE_LEN 128
//??????????
//1 ?????????????д?????
//2 ????????????д?????
//3 ??????????????????浽????У??????????????????й????????????
//????????????????????????
typedef struct _tagMemoryInfo
{
void* addr; //?????????????
size_t size; //????С
_UL lineNum; //?????????亯?????к?
char fileName[MAX_FILE_LEN]; //?????
}MemoryInfo;
//???????????????????????????????union????????????next????????
union FreeList
{
FreeList* next;
MemoryInfo data;
};
typedef struct _tagBusyList
{
_tagBusyList* next;
MemoryInfo* data;
}BusyList;
//??????????????
#define FREE_LIST_INIT_LEN 16
//????????????
static FreeList* g_freeList = NULL;
//????????????????
static BusyList* g_busyList = NULL;
//?????ú?????????
static void _CreateFreeList(int initLen);
static void _ReleaseFreeList();
static void* _GetFreeNode();
static void* _GetBusyNode();
static void _FreeNode(void* p);
static void _WriteMemoryInfo(const MemoryInfo* pInfo ?? bool bAlloc);
static void _StoreMemoryAllocInfo(void* addr ?? size_t size ?? _UL lineNum ?? const char* file);
static void _StoreMemoryDeallocInfo(void* addr);
void* __cdecl operator new(unsigned int size ?? _UL lineNum ?? const char* file)
{
void* p = ::operator new(size);
_StoreMemoryAllocInfo(p ?? size ?? lineNum ?? file);
return p;
//return 0;
}
void __cdecl operator delete(void* p)
{
_StoreMemoryDeallocInfo(p);
}
void __cdecl operator delete(void *p?? _UL lineNum ?? const char* file)
{
lineNum;
file;
_StoreMemoryDeallocInfo(p);
}
void* __cdecl operator new[](unsigned int size ?? _UL lineNum ?? const char* file)
{
void* p = ::operator new(size);
_StoreMemoryAllocInfo(p ?? size ?? lineNum ?? file);
return p;
}
void __cdecl operator delete [] (void *p)
{
_StoreMemoryDeallocInfo(p);
}
void __cdecl operator delete [] (void *p ?? _UL lineNum ?? const char* file)
{
lineNum;
file;
_StoreMemoryDeallocInfo(p);
}
void* __cdecl _DebugMalloc(size_t size ?? _UL lineNum ?? const char* file)
{
void* p = malloc(size);
_StoreMemoryAllocInfo(p ?? size ?? lineNum ?? file);
return p;
}
void* __cdecl _DebugCalloc(size_t num ?? size_t size ?? _UL lineNum ?? const char* file)
{
void* p = calloc(num ?? size);
_StoreMemoryAllocInfo(p ?? num * size ?? lineNum ?? file);
return p;
}
void __cdecl _DebugFree(void* addr)
{
_StoreMemoryDeallocInfo(addr);
}
//???????????????????????????????????????????????
//????????????????????????????????????????????????ó?????????
void _CreateFreeList(int initLen)
{
FreeList* p = (FreeList*)malloc(sizeof(FreeList) * initLen);
g_freeList = p;
for (int idx = 1; idx < initLen; ++idx)
{
p->next = p + idx;
p++;
}
p->next = NULL;
}
void* _GetFreeNode()
{
if ( g_freeList == NULL)
{
_CreateFreeList(FREE_LIST_INIT_LEN);
if ( NULL == g_freeList )
{
return NULL;
}
}
FreeList* p = g_freeList;
g_freeList = g_freeList->next;
return (void*)p;
}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
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????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????