摘要: #include <stdio.h>#include <malloc.h>void* __cdecl operator new( unsigned int size, const char *p, int line){ printf("the file :%s\n", p); printf("the line: %d\n", line); void *ret = malloc(size); return ret;}#define new new(__FILE__, __LINE__)int _tmain(int argc, _TC 阅读全文
posted @ 2012-09-20 20:59 特洛伊人 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 1 ////////////////////////////////////////////////////////////////////////// 2 // Lookaside测试 3 // Lookaside一般在以下情况使用: 4 // 1.每次申请固定大小的内存 5 // 2.频繁申请释放内存 6 7 void LookasideTest() 8 { 9 KdPrint(("Entering LookasideTest function\n"));10 PAGED_LOOKASIDE_LIST lookAside;11 12 // 初始化一个分页Look... 阅读全文
posted @ 2012-09-20 10:37 特洛伊人 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 1 typedef struct _MYDATA 2 { 3 LIST_ENTRY ListEntry; 4 LONG number; 5 }MYDATA, *PMYDATA; 6 7 void LinkedListTest() 8 { 9 LIST_ENTRY head;10 MYDATA *pMyData;11 PLIST_ENTRY pListEntry;12 InitializeListHead(&head);13 14 // 创建链表15 for (int i = 0; i < 10; i++)1... 阅读全文
posted @ 2012-09-20 09:56 特洛伊人 阅读(608) 评论(0) 推荐(0) 编辑