📄 bspmemory.c
字号:
/* bspMemory.c: module to allocate and free memory and also to count them. * Copyright (c) Norman Chin */#include "bsp.h" #include <malloc.h>static long memoryCount= 0L;/* Allocates memory of num bytes */char *MYMALLOC(unsigned num){ char *memory= malloc(num); /* checked for null by caller */ ++memoryCount; /* increment memory counter for debugging */ return(memory);} /* myMalloc() *//* Frees memory pointed to by ptr */void MYFREE(char *ptr) { --memoryCount; /* decrement memory counter for debugging */ free(ptr);} /* myFree() *//* Returns how many memory blocks are still allocated up to this point */long MYMEMORYCOUNT(void){ return(memoryCount);} /* myMemoryCount() *//*** bspMemory.c ***/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -