I'm sure this is a duplicate, but I will still answer:
If you are viewing the size of the task manager, this will give you the size of this process. If there is no โpressureโ (there is a lot of available memory in your system and the process is not running), it makes no sense to reduce the use of virtual memory in the process - this is not unusual for the growth, compression, growth process, it is compressed in a cyclic template when it allocates when it processes the data, and then frees the data used in one processing cycle, allocating memory for the next cycle, and then freeing it again. If the OS needs to โrestoreโ these memory pages, only to return them to your process again, this would be a waste of computing power (assigning and rendering pages to a specific process is not trivial, especially if you cannot know exactly who these pages belong to , first of all, since they need to be "cleared" [filled with zero or some other constant so that the "new owner" could not use the memory for "old data", for example, searching for my password stored in memory]).
Even if the pages still remain the property of this process but are not used, the actual RAM can be used by another process. So this is not a big problem if the pages have not been released for some time.
In addition, in debug mode, the C ++ runtime will save "this memory has been deleted" in all memory that passes through delete . This will help determine "use after free." So, if your application is running in debug mode, do not expect the release of freed EVER memory. It will be reused. Therefore, if you run your code three times, it will not grow three times as much.
source share