List of commits:
Subject Hash Author Date (UTC)
mem_check.h: Renamed all macros to be in the format MEMCHECK_name dfc0166e38d3fce58b03033507d32dee23ca9feb Josiah Mullins 2023-10-23 19:33:14
mem_check.h: Added support for typecasting the declarations. 37dc1d6bdd6f4bf770d41146c6f614059b9f1d02 Josiah Mullins 2023-10-05 18:11:09
Moved mem_check.c to mem_check_scanner.c 4a6548f5dd52c419dfa3b46b53dc8ff17f044203 Josiah Mullins 2023-10-05 18:04:42
README: Added instructions to include init and close calls in program. 9ceea9c4ae0c169a69fc1a0840402bfc2a2843cc Josiah Mullins 2023-10-05 18:02:22
Fixed bug with allocate memory and added include guards. 01034908e928b996abf6b92804a9f68112617af1 Josiah_Mullins_E6440 2020-02-14 17:53:16
master: initial commit of mem_check ede7de7550d3243f98279b5bd69eba18748105fa Josiah_Mullins_E6440 2020-02-12 17:42:39
Commit dfc0166e38d3fce58b03033507d32dee23ca9feb - mem_check.h: Renamed all macros to be in the format MEMCHECK_name
"name" is the name equivalent stdlib.h function, for example,
MEMCHECK_MALLOC()
Author: Josiah Mullins
Author date (UTC): 2023-10-23 19:33
Committer name: Josiah Mullins
Committer date (UTC): 2023-10-23 19:33
Parent(s): 37dc1d6bdd6f4bf770d41146c6f614059b9f1d02
Signing key:
Tree: ca9cdd81e7aae2919c7b408ed3be9e6b1713440c
File Lines added Lines deleted
mem_check.h 10 10
File mem_check.h changed (mode: 100644) (index a4c70b7..97f895d)
13 13 //This is defined globally. //This is defined globally.
14 14 FILE* fp_mem_log; FILE* fp_mem_log;
15 15
16 #define allocate_memory(data, type, size) {\
16 #define MEMCHECK_MALLOC(data, type, size) {\
17 17 data = (type)malloc(size);\ data = (type)malloc(size);\
18 18 fprintf(fp_mem_log,"a%p,0x0\n",(void*)data);\ fprintf(fp_mem_log,"a%p,0x0\n",(void*)data);\
19 19 } }
20 20
21 #define realloc_memory(data_out, type, data_in, size) {\
21 #define MEMCHECK_REALLOC(data_out, type, data_in, size) {\
22 22 fprintf(fp_mem_log,"r%p,",(void*)data_in);\ fprintf(fp_mem_log,"r%p,",(void*)data_in);\
23 23 data_out = (type)realloc(data_in,size);\ data_out = (type)realloc(data_in,size);\
24 24 fprintf(fp_mem_log,"%p\n",(void*)data_out);\ fprintf(fp_mem_log,"%p\n",(void*)data_out);\
25 25 } }
26 26
27 #define free_memory(data) {\
27 #define MEMCHECK_FREE(data) {\
28 28 fprintf(fp_mem_log,"f%p,0x0\n",(void*)data);\ fprintf(fp_mem_log,"f%p,0x0\n",(void*)data);\
29 29 free(data);\ free(data);\
30 30 } }
31 31
32 #define init_check_mem() {\
32 #define MEMCHECK_INIT() {\
33 33 fp_mem_log = fopen("mem_check.log","w");\ fp_mem_log = fopen("mem_check.log","w");\
34 34 if(fp_mem_log == NULL){\ if(fp_mem_log == NULL){\
35 35 printf("Unable to open log file. errno: %d\n",errno);\ printf("Unable to open log file. errno: %d\n",errno);\
 
... ... FILE* fp_mem_log;
38 38 setbuf(fp_mem_log,NULL);\ setbuf(fp_mem_log,NULL);\
39 39 } }
40 40
41 #define close_check_mem() {\
41 #define MEMCHECK_CLOSE() {\
42 42 fclose(fp_mem_log);\ fclose(fp_mem_log);\
43 43 } }
44 44
45 45 #else #else
46 #define allocate_memory(data, type, size) {\
46 #define MEMCHECK_MALLOC(data, type, size) {\
47 47 data = (type)malloc(size);\ data = (type)malloc(size);\
48 48 } }
49 49
50 #define realloc_memory(data_out, type, data_in, size) {\
50 #define MEMCHECK_REALLOC(data_out, type, data_in, size) {\
51 51 data_out = (type)realloc(data_in,size);\ data_out = (type)realloc(data_in,size);\
52 52 } }
53 53
54 #define free_memory(data) {\
54 #define MEMCHECK_FREE(data) {\
55 55 free(data);\ free(data);\
56 56 }; };
57 57
58 #define init_check_mem
59 #define close_check_mem
58 #define MEMCHECK_INIT
59 #define MEMCHECK_CLOSE
60 60 #endif #endif
61 61
62 62 #endif #endif
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/ORpKTKoVQnFhs/Memory_Check

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/ORpKTKoVQnFhs/Memory_Check

Clone this repository using git:
git clone git://git.rocketgit.com/user/ORpKTKoVQnFhs/Memory_Check

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main