hi there i've got the following code to test on, you can try it on your computer aswell
char* array = new char;
ive placed breakpoints on all rows and steps my way through during debugmode
in taskmanager in windows i look at how much memory my application is using and after it excecuted row 2 the memoryusage increases but after it excectued row 4 the memoryusage doesnt decrease. its as if delete had no effect
however if i increase the size of the array to 1000000 the memoryusage does decrease and its as if delete is doing what its supposed to.
i can imagine that therse some sort windows memory usage optimization algorithm lying in the background causing this problem.
and the problem is that there's no way to test for small memory leaks if theres no change in the memoryusage reading.
my question is when does the "small" memory get deleted by the OS? this might be a hard question and possibly i posted this in the wrong category but this is a problem i have when i program in C++
0 · ·