Forum Discussion
7 years ago
It's normal bro. It's called memory leaked and it happens in every game i played, haiz from battlefield, call of duty to pubg.
The longer u play, the more memory the game eats and never release
The longer u play, the more memory the game eats and never release
7 years ago
@d3adc3II wrote:
It's normal bro. It's called memory leaked and it happens in every game i played, haiz from battlefield, call of duty to pubg.
The longer u play, the more memory the game eats and never release
// some c++
size_t size(0);
double *temp_ptr(nullptr);
cout << "how many temps? ";
cin >> size;
temp_ptr = new double[size];
cout << temp_ptr << endl;
// incorrect; creating a memory leak
temp_ptr = nullptr;
delete [] temp_ptr;
// correct; creating a memory leak
delete [] temp_ptr;
temp_ptr = nullptr;
// so if you have a memory leak, use (delete[] name_of_variable) before (name_of_variable = nullptr).
- 7 years ago
i had a logical bug in my previous reply, so i fixed the code. its how to fix memory leaks from incorrectly using the heap.