List of commits:
Subject Hash Author Date (UTC)
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 37dc1d6bdd6f4bf770d41146c6f614059b9f1d02 - mem_check.h: Added support for typecasting the declarations.
For example, the old style:
allocate_memory(data, size) -> data = malloc(size);
The new style:
allocate_memory(data, type, size) -> data = (type)malloc(size);
Author: Josiah Mullins
Author date (UTC): 2023-10-05 18:11
Committer name: Josiah Mullins
Committer date (UTC): 2023-10-05 18:11
Parent(s): 4a6548f5dd52c419dfa3b46b53dc8ff17f044203
Signing key:
Tree: 403da39977e6c8dd4981512f60d863cdcf3a2389
File Lines added Lines deleted
mem_check.h 20 19
File mem_check.h changed (mode: 100644) (index 6697aa1..a4c70b7)
10 10 #endif #endif
11 11
12 12 #if(MEMORY_CHECK==1) #if(MEMORY_CHECK==1)
13 //This is defined globally.
13 14 FILE* fp_mem_log; FILE* fp_mem_log;
14 15
15 #define allocate_memory(data, size) {\
16 data = malloc(size);\
16 #define allocate_memory(data, type, size) {\
17 data = (type)malloc(size);\
17 18 fprintf(fp_mem_log,"a%p,0x0\n",(void*)data);\ fprintf(fp_mem_log,"a%p,0x0\n",(void*)data);\
18 19 } }
19 20
20 #define realloc_memory(data, size) {\
21 fprintf(fp_mem_log,"r%p,",(void*)data);\
22 data = realloc(data,size);\
23 fprintf(fp_mem_log,"%p\n",(void*)data);\
24 }
21 #define realloc_memory(data_out, type, data_in, size) {\
22 fprintf(fp_mem_log,"r%p,",(void*)data_in);\
23 data_out = (type)realloc(data_in,size);\
24 fprintf(fp_mem_log,"%p\n",(void*)data_out);\
25 }
25 26
26 27 #define free_memory(data) {\ #define free_memory(data) {\
27 28 fprintf(fp_mem_log,"f%p,0x0\n",(void*)data);\ fprintf(fp_mem_log,"f%p,0x0\n",(void*)data);\
28 29 free(data);\ free(data);\
29 }
30
30 }
31
31 32 #define init_check_mem() {\ #define init_check_mem() {\
32 33 fp_mem_log = fopen("mem_check.log","w");\ fp_mem_log = fopen("mem_check.log","w");\
33 34 if(fp_mem_log == NULL){\ if(fp_mem_log == NULL){\
 
... ... FILE* fp_mem_log;
36 37 }\ }\
37 38 setbuf(fp_mem_log,NULL);\ setbuf(fp_mem_log,NULL);\
38 39 } }
39
40
40 41 #define close_check_mem() {\ #define close_check_mem() {\
41 42 fclose(fp_mem_log);\ fclose(fp_mem_log);\
42 }
43
43 }
44
44 45 #else #else
45 #define allocate_memory(data, size) {\
46 data = malloc(size);\
46 #define allocate_memory(data, type, size) {\
47 data = (type)malloc(size);\
47 48 } }
48 49
49 #define realloc_memory(data, size) {\
50 data = realloc(data,size);\
50 #define realloc_memory(data_out, type, data_in, size) {\
51 data_out = (type)realloc(data_in,size);\
51 52 } }
52 53
53 54 #define free_memory(data) {\ #define free_memory(data) {\
54 55 free(data);\ free(data);\
55 56 }; };
56
57 #define init_check_mem
58 #define close_check_mem
57
58 #define init_check_mem
59 #define close_check_mem
59 60 #endif #endif
60 61
61 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