Suppose at the start of the application 1 Gb of memory was required. OS highlighted. After some time, consumption dropped to an average of 100 Mb and remained so in the future.

As far as I understand, unused 900 Mb will remain unused and not returned to the OS?

If you really do not use them, then one day the garbage collector will reach them and return them to the system.

andreymal2021-02-23 14:20:23
  • Answer # 1

    if you selected and then did not release, then of course it will hang until the end of the program, but nothing prevents to allocate 1100, write results to 100 and free 1000

    again -if there is only one such application in the system, and let yourself eat this gigabyte, it's not very scary :)

    but nothing prevents you from allocating 1100, writing the results to 100 and freeing 1000 -not c /c++, you won't run away much.

    Victor VosMottor2021-02-23 14:19:47

    Doesn't answer the question. To leave your comments or ask the author for clarifications, leave a comment on the corresponding message. -from the check queue

    finally2021-02-23 14:36:08