-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMalloc_list.h
58 lines (53 loc) · 1.38 KB
/
Malloc_list.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Created by xande on 12/9/2022.
//
#ifndef XANDEBUG_MALLOC_LIST_H
#define XANDEBUG_MALLOC_LIST_H
#include <iostream>
class Node{
public:
int memory_malloc_size;
int memory_free_size;
int memory_new_size;
int memory_delete_size;
int line;
char * file;
Node* next;
Node() {
this->memory_delete_size = 0;
this->memory_new_size = 0;
this->memory_free_size = 0;
this->memory_malloc_size = 0;
this->file = 0;
this->line = 0;
this->next = nullptr;
}
int getMemoryMallocSize() const {return this->memory_malloc_size; }
int getMemoryFreeSize() const { return this->memory_free_size;}
int getMemoryNewSize() const {return this->memory_new_size;}
int getMemoryDeleteSize() const {return this->memory_delete_size;}
int getLine() const {return this->line; }
std::string getFile() const { return this->file; }
};
class Malloc_list {
public:
Node* head;
Malloc_list() {
head = NULL;
}
~Malloc_list() {
Node *curr = head;
while(curr != nullptr) {
Node* temp = curr;
curr = curr->next;
delete temp;
}
}
void malloc_list_append(int size,
int line,
char * file,
bool malloc
);
};
//change
#endif //XANDEBUG_MALLOC_LIST_H